Style gets lost on deselecting a component when using rte.exec method
Question
Hi @artf, When setting the backcolor/forecolor (or any other formatting like fontsize, etc) using the RichTextEditor toolbar, the formatting gets lost on deselecting > selecting and deselecting the component again. Please see the demo on code pen - https://codepen.io/AbdiasM/pen/LYVydpr Moreover, the RTE toolbar doesn't show again on entering edit mode. Steps to reproduce:Drop a text blockDouble click the text block and select some text (eg. here)Click on the last icon in the RTE Toolbar and set the backcolor Observe: Backcolor is appliedClick outside the text blockDouble click text block aga...
Answers (3)
Anyone?
Solved this by setting avoidInlineStyle: 0, forceClass :0, in editor's config However, the issue still occurs if template is imported. It can be reproduced on the GrapesJS demo page (https://grapesjs.com/demo.html) as well.Import the following template: <div id="ipwi" class="c1423">Test <span dragg...
Thanks for the report @AbdiasM we're already aware of the issue, it should be fixed once #1470 will be solved (so you can subscribe to the issue there)
Related Questions and Answers
Continue research with similar issue discussions.
Issue #2472
DragData extend for other components like div etc
Hi @artf How to implement dragData event for custom components(external).I called dragData method on div drag but dataTransfer and content...
Issue #1639
Would it be possible to have change settings under style manager in a way that it has href when a link is created?
I'm using preset newsletter with built-in RTE (do not want to use ck editor like the demo) In order to make any text to link, i need to cli...
Issue #1327
Replacing selected text and getting html
Hi! Im trying to replace selected text with a code (random code). It's works, i can see the code, but when i do editor.getHtml() not. If i...
Issue #4797
Change type keepUnusedStyles?: 0;
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? any Reproducible demo link n/a Describe th...
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
Vanilla GrapesJS vs GrapesJS With Plugins: What You Actually Get Out of the Box (2026)
New to GrapesJS? See exactly what the stock editor gives you, where it falls short, and which plugins close the gaps β a beginner-friendly 2026 comparison
Tutorial
Lighthouse for GrapesJS: Audit Accessibility and SEO Without Leaving the Editor
Live WCAG 2.1/2.2 accessibility auditor + SEO manager for GrapesJS. Every finding is bound to the exact component β click to select, then one-click fix.
Tutorial
GrapesJS DevTools: A Developer Panel Inside Your Editor
If you've ever debugged GrapesJS with console.log(editor.getSelected()) and a dozen throwaway event listeners β this post is for you.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.