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
How to Build an AI-Powered Page Builder with GrapesJS in 2026
What we learned building GJSDocs β from simple AI text generation to structured, context-aware visual editing
Tutorial
How Much Does It Cost to Build a SaaS Page Builder in 2026?
How much does it cost to build a SaaS page builder in 2026? Explore realistic development costs, timelines, features, and how using GrapesJS can reduce
Tutorial
PageKit: the GrapesJS application you'd have to build anyway
A source-available Next.js app around the open-source GrapesJS core β publishing, custom domains, leads, checkout and a plugin loader.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.