facebook / lexical

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

Bug: Header becomes a numbered list #5646

Open ronaldlangeveld opened 4 months ago

ronaldlangeveld commented 4 months ago

Lexical version: 0.13.1

Steps To Reproduce

  1. Go to the Lexical Playground
  2. Modify the Welcome to the playground header and make it 1. Welcome to the playground
  3. Notice it converts to a numbered list item instead of remaining a header as soon as you make a space between 1. and Welcome
Screenshot 2024-02-22 at 10 37 49 Screenshot 2024-02-22 at 10 38 12
acywatson commented 4 months ago

Thanks for reporting - what is the expected outcome here?

ronaldlangeveld commented 4 months ago

Thanks for reporting - what is the expected outcome here?

To be able to type a header, with a number in front, without automatically converting it to numbered list, eg:

1. Header title

Thanks! :)

ivailop7 commented 3 months ago

Ah, have been meaning to look into this one.

ivailop7 commented 3 months ago

@acywatson you know the list plugin the most, can you help me on this one?

ivailop7 commented 3 months ago

This needs a generic fix, allowing for bulleting/unbulleting of code block and quote block as well.

ronaldlangeveld commented 3 months ago

Thanks for looking into it @ivailop7 🙏🏻

WoodenPC commented 3 months ago

up

acywatson commented 3 months ago

I think this is actually an issue with the markdown shortcut plugin, as opposed to the list plugin. If you just don't use the markdown shortcut plugin, this won't happen.

It does probably also make sense to change the markdown plugin somehow to not to the list transformation in certain situations (like when the parent is a heading). I'm not sure if this should be the default or a config option, though.

ivailop7 commented 3 months ago

Tried it with MarkdownShortcuts plugin disabled, it's still not behaving correctly. I had look at this some time ago. It's an issue for anything that doesn't have a paragraph as a parent, which is why bulleting of links and images works (they are children of a paragraph), while Quote, Heading, Collapsible Section are not.

acywatson commented 3 months ago

Tried it with MarkdownShortcuts plugin disabled, it's still not behaving correctly. I had look at this some time ago. It's an issue for anything that doesn't have a paragraph as a parent, which is why bulleting of links and images works (they are children of a paragraph), while Quote, Heading, Collapsible Section are not.

So that sounds like a different thing. The issue described here is about entering a "1." followed by a space in a heading. The ListPlugin doesn't look for that by default.

ivailop7 commented 3 months ago

Tried it with MarkdownShortcuts plugin disabled, it's still not behaving correctly. I had look at this some time ago. It's an issue for anything that doesn't have a paragraph as a parent, which is why bulleting of links and images works (they are children of a paragraph), while Quote, Heading, Collapsible Section are not.

So that sounds like a different thing. The issue described here is about entering a "1." followed by a space in a heading. The ListPlugin doesn't look for that by default.

Oh, my fault, misinterpreted the original post. I was referring to the ability to have a heading inside a bullet list vs the auto-conversion referred to here. Ignore my comment, you are right.