Bug: Selection cursor grabs empty adjacent parent nodes
- Dominant language
- TypeScript
- Stars
- 23.9k
- Forks
- 2.2k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 57
Description
When using `Shift+Up` or selecting with the mouse drag, the selection cursor tends to grab adjacent parent nodes (and none of their content). The end result of this is that any cut/copy/paste actions insert an empty parent node.
Example using paragraphs with `Shift+Up`, although the same applies to using the mouse:
https://github.com/facebook/lexical/assets/21961100/b2b1b30d-680e-4a10-b9df-e93aa1421248
Lexical version: v0.12.2
## Steps To Reproduce
1. Type a word
2. Hit enter
3. Type another word
4. Use `Shift+Up` to select the whole second paragraph
5. Copy+paste
You will see an empty paragraph node inserted. This is because the selection contains the first `ParagraphNode` but none of the child nodes within it.
## The current behavior
Extra empty nodes are being inserted.
## The expected behavior
Only nodes containing content should be inserted.
Contributor guide
Assessment
This issue has not been assessed yet.