Issue #5312πŸ’¬ AnsweredOpened August 17, 2023by srinivas9770 reactions

Issue with rich text editor Indent action for Lists

Quick answerby artf

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?

  1. 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?

  1. The items within the sub-list must not vanish.
  2. 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?

  1. The items in the sub-list are vanishing
  2. 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)

artfβ€’ August 23, 2023

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.

ClaudeCodeβ€’ May 17, 2026

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:add for CSS selector changes
  • Use selector:custom for 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.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins β†’
Premium option

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.

All tutorials β†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.