facebook / lexical

Lexical is an extensible text editor framework that provides excellent reliability, accessibility and performance.
https://lexical.dev
MIT License
19.14k stars 1.62k forks source link

Bug: Code block breaks list #5218

Open vadimyen opened 10 months ago

vadimyen commented 10 months ago

Description

When inserting a code block within a list item, the code block is treated as a separate element, breaking the list. The expectation is for the code block to be part of the list item, allowing the list to continue seamlessly after the code block.

It may be an intentional behavior. Is there a way to work it around?

Lexical version: 0.11.3

Steps to Reproduce

  1. Open the RTE.
  2. Start a numbered or bullet list.
  3. Insert a code block within a list item.

Link to code example:

Please see the behavior by trying it in the Lexical playground: Lexical Playground

The current behavior

Inserting a code block while editing a list item causes the list to break. The code block appears as a separate block element outside of the list context. image

Expected Behavior

When a code block is inserted into a list item, it should be displayed as part of that item, indented accordingly, and not disrupt the list flow. The list numbering or bullets should continue after the code block as if it were part of the text in the list item.

moy2010 commented 10 months ago

There are plans to support custom schemas in the future, but for now there's no way to support the behaviour that you want.

vadimyen commented 10 months ago

@moy2010, thanks for the answer!

Akbar1437 commented 10 months ago

yes, I have a similar problem

vadimyen commented 8 months ago

Has anyone found workarounds? It's a crucial functionality for my users.