Issue #774πŸ’¬ AnsweredOpened January 18, 2018by ryandeba0 reactions

Mimic customRTE behavior when parsing content

Quick answerby ryandeba

Now that I think through this a bit more, option 1 wouldn't really work for me since I want to prevent any inline styles from getting removed, as well as preventing any id's/classes/attributes from getting added to the child elements. So I guess that leaves option 2 or maybe another solution that I haven't thought of.

Read full answer below ↓

Question

Hi @artf, I'd like to replicate this behavior when calling editor.setComponents("<div>This is a text component. <span style='font-size: 20px;'>This is a nested element that I don't want get parsed out.</span></div>"). In that example, I would want the nested span to not get parsed as its own component so that I cannot select it or interact with it in any way (much the same as if I had enabled/disabled a customRTE on the div). I'm seeing 2 options here:After calling editor.setComponents, programmatically enable and disable RTE on outer div so that the child elements & text are treated as conte...

Answers (3)

ryandebaβ€’ January 18, 2018

Now that I think through this a bit more, option 1 wouldn't really work for me since I want to prevent any inline styles from getting removed, as well as preventing any id's/classes/attributes from getting added to the child elements. So I guess that leaves option 2 or maybe another solution that I...

artfβ€’ January 19, 2018

Hey Ryan what about this custom component

ryandebaβ€’ January 19, 2018

Thanks @artf! I bet your suggestion will work for me - I'll test it out in the next few hours.

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 β†’

Related tutorials

In-depth guides on the same topic.

All tutorials β†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.