New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Selection cursor grabs empty adjacent parent nodes #5124
Comments
This is obviously a question of very core behavior. The problem is that we're creating unnecessary empty nodes when pasting content because of the current selection behavior. While not a problem for inline content, it does become a problem when writing something with multiple children of the root node. This has downstream effects like #4723 because the existing handling doesn't account for empty nodes (as people generally can't copy and paste empty nodes). It feels like it may be more appropriate for the |
CleanShot.2023-10-16.at.20.08.49.mp4This is a very simple example of the behavior that clearly feels incorrect. I wouldn't expect the first If you're copying and pasting content over itself, there should obviously be no change. |
Hi @9larsons thanks for your feedback, yes I can reproduce it. |
Thanks for details, Actually, other editors and even the native contenteditable don't do that so I would dare to say that the behavior is intended. |
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
Shift+Up
to select the whole second paragraphYou 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.
The text was updated successfully, but these errors were encountered: