Issue #2807💬 AnsweredOpened May 27, 2020by alesub0 reactions

Starting editor "fromElement" creates components inside tag with data-gjs-type="text"

快速解答by alesub

@artf just to clarify: this bug is based on the expected behaviour you described on this comment: https://github.com/artf/grapesjs/issues/576#issuecomment-348550694 And how the divs with text behave on the demo page. Please let me know if I got it wrong, Thank again!

Read full answer below ↓

Question

Hi,

I'm currently trying to start the editor "fromElement", setting the following html inside the container:

<p data-gjs-type="text" contenteditable="true">
Lorem asd dolor sit amet consectetur, adipisicing elit. Similique repellat <b>voluptatum</b> 
voluptas ex, esse error sed culpa <i>impedit</i>, <strike>eum amet </strike> laboriosam <strike>. 
Doloribus, maxime fuga eum aliquid non doloremque </strike>soluta quod.
</p>

But when executed, grapesjs creates components inside the <p> tag even after setting the data-gjs-type attribute as text. What I'm trying to do is to present the paragraph to be edited as a single component.

You can see the issue in action here: https://codepen.io/alesub/pen/xxwNaPd

Thanks for this great tool!

Answers (3)

alesubJune 1, 2020

Hi, any luck reviewing this issue? What got me lost is this doesn't happen on the demo page, any bold or italic text doesn't become a separate component after saving or reloading.

Any insight will be greatly appreciated, 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...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.