Bug: select all + delete should remove all blocks
When doing select all (e.g. ctrl + A or cmd + A on Mac - I think), and then pressing delete or backspace, my expectation would be that all of the content is completely erased, including any blocks, and instead you'd get the same thing you'd get when loading an editor instance without initial state: an empty paragraph block.
Instead, what happens is that everything is removed, but the remaining block is what the first block already was, except empty. For example, if the first block was a list item, it will remain after following this process, but empty.
Lexical version: 0.14.3
Steps To Reproduce
1.Put some stuff on the editor. Make sure the first block is not a paragraph block. 2. Select all. 3. Delete
Link to code example: Link to sandbox
The current behavior
https://github.com/facebook/lexical/assets/126766271/004fa505-ddf5-402f-9b01-8fd488893483
The expected behavior
Editor is clear after delete is pressed
P.S Same bugfix was closed, but seems, that problem is still reproducable https://github.com/facebook/lexical/issues/3682
Yeah, I can repro when the bullet list is the first node. Still valid as of 0.16.0
Still valid in v0.21.0. I think this is basically another presentation of #6086 - the selection anchor or focus always migrates to the TextNode during normalization and our delete code doesn't have a special-case to handle this just like copy doesn't.