Clicking 'wrap for style' button affects the inner components of other components inside the same text box
RTE relies on the DOM content during the editing so if you remove it deliberately with something like inner components will be removed once the editing is finished.
Read full answer below โQuestion
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Chrome 104.0.5112.101 Reproducible demo link https://jsfiddle.net/7cLr0xt2/3/Describe the bug How to reproduce the bug? For some reason I'm unable to reproduce the bug inside the fiddle linked above, since line 34 selectedComponent.components('<span liquid="if contact.id">jhbjhhgjjh</span> <span liquid="else">qwewqeqwe</span>') doesn't replace the inner components of the component, so I'll have to share a video of what happens with my project instead, but the steps are as follows:Double click on the...
Answers (4)
RTE relies on the DOM content during the editing so if you remove it deliberately with something like
onRender() {
this.el.innerHTML = this.model.get("displayedText")
},
inner components will be removed once the editing is finished.
Ok thanks @artf, that makes sense. However, those lines of code, along with are required to render the correct selected state inside the canvas as follows (both upon the component initially being rendered and when the user selects a different 'if' state, thus changing displayedText): https://user-i...
I need to do some more testing but it looks like I've got around this behaviour by saving the inner components inside the component itself when first creating it / editing it, then using the rte:disable hook as follows: It seems a bit hacky so if you can think of a better way then please let me kno...
Thanks for reporting this, @benryanwilliams. Great question about Clicking 'wrap for style' button affects the inner components of other components inside the same text box. The recommended approach with ProseMirror is to use the event-driven API. Start here: Check the GrapesJS documentation for yo...
Related Questions and Answers
Continue research with similar issue discussions.
Issue #6706
TypeError: e.getRoot is not a function (Race condition in Style Manager)
GrapesJS version [x] I confirm to use the latest version of GrapesJS What browser are you using? All browsers (Chrome, Safari, Firefox, Edg...
Issue #5086
Style:property:update and Property onChange trigger excessively
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome Version 112.0.5615.137 (Official Bu...
Issue #5990
When you delete a component, duplicate classes between components will be deleted.
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome 126.0.6478.127(Windows) Reproducibl...
Issue #4350
Style Manager don't update background when component is selected
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Brave Browser V1.39.111 Reproducible demo...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins โ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.
Tutorial
How to Build a Production GrapesJS Editor: The Complete Walkthrough of Brief, Preset, Plugins, and Services
A complete walkthrough of building a production GrapesJS editor: how to choose a preset, pick plugins, and scope setup services without burning a sprint.
Tutorial
Big Updates: TinyMCE 8 and Placeholder 2.0 for GrapesJS
In May we shipped major updates to two of our most popular GrapesJS plugins โ TinyMCE Inline Text Editor and Placeholder.
Tutorial
Find the Right GrapesJS Plugin in Seconds: Smarter Discovery Is Live
We're shipping a set of discovery upgrades. New label filters, a proper compatibility switch for GrapesJS vs Studio, one-click and a smarter sort bar.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.