Style gone on link or nested text elements after exiting edit
Hi @orosl, thanks for the report. I was able to find and fix the bug so, it'll be available in the next release.
Read full answer below ↓Question
Hello,
I am editing legacy HTML with version 0.16.3 + newsleter-plugin. The style is stored inline (since the tool is used for authoring emails) and I use the feature componentFirst: true .
I am facing a problem when trying to edit Component Text that has other text elements inside.
<div style="font-size: 20px;" class="my-class" >
A text component
<span style="font-size: 35px;">---and a text inside---</span>
</div>
Once I edit the text from the parent div, the styling of the nested element disappears at blur. The inline style is stored on the id and the id of the subnode is completely removed.
How can I stop this from happening?
The behavior is presented in this JSFiddle: https://jsfiddle.net/jsh8yv4p/
I have read about including the text inside the parent div in a span or another text element, but since the HTML that is loaded in the editor is legacy I do not want to alter its structure in this manner.
Is there any way I can edit text(that might have subnodes) and not alter the subnodes?
Thank you in advance, Lavinia
Answers (3)
Hi @orosl, thanks for the report. I was able to find and fix the bug so, it'll be available in the next release.
Hi @artf, thank you very much for your prompt response and release. I upgraded with the latest version 0.16.27. However I still encounter the problem, but with a slightly different behavior.
I am not sure if I should open a new issue since it is partially solved but nonetheless, I will explain the behavior here.
Given a similar configuration as above and presented in this demo: https://jsfiddle.net/x5srzpvk/5
If I change the styling of the link(or any other such element) in the nested span element, after an edit, the styling is lost since the id is altered (styling is kept on the id).
So, id: jp365 transforms into jp365-2 and continues to be added -2-2 after each edit. I encountered this behavior in multiple similar situations. Also, the HTML gets difficult to read after many edits, as the ids increase in size.
Is there any way I can stop the process of altering ids of subnodes if text is edited?
Thank you and much appreciation, Lavinia
Thanks @orosl actually the fix was working with inner components but not with nested ones. I'll fix it in the next release
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3832
The css classes are removed and the autogenerated ids for each html tags gets changed ( Example : ivj5m-2) after each reload
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome Reproducible demo link Not there De...
Issue #4837
HTML elements ids are incremented on different pages loaded in projectData
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Firefox 109 Reproducible demo link https:/...
Issue #5729
editing/replacing the text inside of a link
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome v122 Reproducible demo link https:/...
Issue #4848
Component content is set to empty string after inline editing
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Firefox v91.4.1 Reproducible demo link htt...
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
GrapesJS Inline RTE Plugins Update: CKEditor 5 v0.1.4 and Froala Inline Text Editor
CKEditor 5 Inline for GrapesJS v0.1.4 fixes Studio SDK toolbar clipping, iframe injection and link balloon bugs. Compare with Froala Inline — both $69.
Tutorial
Embed GrapesJS in Your SaaS: A Weekend Guide
Embed GrapesJS in your SaaS and ship a white-label page builder over a weekend. Honest tradeoffs, real code, and the plugins that close the UX gap.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.