Issue #1408Opened September 6, 2018by Siddharth-ss422791 reactions

Why Text element converted into box ??

Question

Hi @artf ,

I am using grapesjs newsletter plugin with ckeditor plugin. I dragged TEXT element in canvas and did some editing with ckeditor. i have connected it to database. when ever i save content in database after reloding the editor i set content value from database field and after that TEXT element get converted into BOX. dont know why TEXT element is changing to BOX and also ckeditor in not loading in that BOX element ?? Please help me out in this.

screen shot 2018-09-06 at 6 47 41 pm

Answers (3)

artfSeptember 11, 20181 reactions

@Siddharth-ss42279 If you need to EDIT the template created from GrapesJS, you SHOULD NOT USE ITS HTML.... you should import its JSON... so you're doing it WRONG

It's like doing this

el.addEventListener('click', ...);
someOtheEl.innerHTML = el.innerHTML;

and then complaining why your el doesn't have click listener anymore... you're just ripping off all the information created by the editor.

Read here: https://grapesjs.com/docs/modules/Storage.html

artfSeptember 7, 20180 reactions

What do you store in your database? The HTML and CSS?

Siddharth-ss42279September 7, 20180 reactions

Hi @artf Actually, i get in-lined html using command editor.Commands.get('gjs-get-inline-html').run(editor) and saving it to database and for rendering content i am using editor.setComponent(content_field)

problem is when i render content from database the TEXT element gets converted into BOX element (only when i edit some text in that text element using ckeditor) and in BOX element ckeditor in not loading.

Either one of the below can solve my problem :

  1. TEXT element should not get converted into BOX
  2. or, BOX element should load ckeditor

step to replicate the issue in grapesjs newsletter demo:

  1. goto: https://grapesjs.com/demo-newsletter-editor.html
  2. drag text element on canvas.
  3. now select some text in that and apply style, bold and color to that text from ckeditor.
  4. hover over the text element you will see it still showing the TEXT on the top screen shot 2018-09-07 at 6 39 19 pm
  5. Now copy the code from view code modal.
  6. again Import that copied code from import button.

observation: now TEXT element has converted to BOX ???? screen shot 2018-09-07 at 6 43 48 pm

and ckeditor in not opening in that box.

any help would be appreciated and Thanks.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.