Issue with rich text editor Indent action for Lists
Unfortunately, as the default implementation relies on the deprecated execCommand, there are too many edge cases to handle and it isn't worth spending time on it anymore. I'd suggest relying on it only for basic formatting (eg. bold, italic, underline, etc.), for more complex elements I'd highly recommend creating cus...
Read full answer below βQuestion
GrapesJS version
- I confirm to use the latest version of GrapesJS
What browser are you using?
Chrome V115
Reproducible demo link
https://jsfiddle.net/srinivas977/ahgLxv6e/10/
Describe the bug
How to reproduce the bug?
- In the provided JSFiddle, include a pair of text lines and select lists. Next, append a sub-list, and then add the sub-list. Afterward, clicking outside the chosen element causes one of the items in the sub-list to vanish.
The occurrence is also visible in this video link(notice it from 30th second in the video):
https://github.com/GrapesJS/grapesjs/assets/49796104/59de9aa5-5f3f-43ae-9ed1-358b86ac8b27
What is the expected behavior?
- The items within the sub-list must not vanish.
- Upon selecting the indent action, it is automatically assigned the same type (ordered/unordered list) as its parent list by default, which results in invalid HTML. Example: Element 'ol' not allowed as child of element 'ol'
What is the current behavior?
- The items in the sub-list are vanishing
- It should validate the HTML and assign the corresponding (ordered/unordered list tag) based on the parent tag ...
Code of Conduct
- I agree to follow this project's Code of Conduct
Answers (2)
Unfortunately, as the default implementation relies on the deprecated execCommand, there are too many edge cases to handle and it isn't worth spending time on it anymore. I'd suggest relying on it only for basic formatting (eg. bold, italic, underline, etc.), for more complex elements I'd highly recommend creating custom components or replacing the built-in Rich Text Editor.
Thanks for reporting this, @srinivas977.
Great suggestion about Issue with rich text editor Indent action for Lists! While this specific feature isn't yet in the core API, there are several ways to achieve similar behavior.
Using the event system:
editor.on('component:update', (component) => {
// your logic here
});
Alternative approaches:
- Listen to
selector:addfor CSS selector changes - Use
selector:customfor custom rules - Tap into the
change:*events for fine-grained tracking - Build a plugin that extends the editor with this capability
Making it official: If this feature would benefit many users, consider opening a formal Feature Request on the GrapesJS repo with:
- A detailed use case
- Code example showing the desired behavior
- Why this matters for your workflow
The core team is receptive to well-motivated feature requests backed by real use cases.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #4385
index.d.ts says that run commands should return void but docs say their return value may be used
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Any Reproducible demo link https://grapesj...
Issue #6603
Ampersand is not escaped in attribute value
GrapesJS version [x] I confirm to use the latest version of GrapesJS What browser are you using? Chrome v142.0.7392.0 (canary) Reproducible...
Issue #5199
Changes in component's attributes being reproduced in all the instances instead of just one
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome v114 Reproducible demo link https:/...
Issue #6416
htmlentities > breaking remote storage - Displays undefined
GrapesJS version [x] I confirm to use the latest version of GrapesJS What browser are you using? Firefox and Chrome Reproducible demo link...
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
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.
Tutorial
GrapesJS vs Webflow vs Tilda: What to Choose for Your Business in 2026
Choosing the right website platform in 2026 is no longer just about building a site
Tutorial
GJS Market 2.0 - Donations, Tracking, Labels and Better Product Discovery
Weβve rolled out a new set of GrapesJS marketplace updates across GJS Market, focused on improving how creators distribute products
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.