Bug: RangeSelection
using root splices text from last node
#4658
Labels
all-platforms-bug
core
Reconciler, DOM, Selection, Node, Events, Composition
core-team
core team priority issue
Lexical version: v0.11.1
Steps To Reproduce
Link to code example:
https://github.com/facebook/lexical/pull/4586/files this PR is what surfaced this issue, but I'm also trying to implement a similar solution (using root-based
RangeSelection
) as a workaround for another bug and am running in to the issue there as well.This works great with a decorator node in the content, but if it's just text (or text is the last child of root), the content is spliced because of this line.
The current behavior
If a text node is the last node in root, the content is spliced based on the root offset, which doesn't make sense.
The expected behavior
If a text node is the last node in root, do not splice the content.
Note, the workaround to this is inserting a blank paragraph node on select all, but that can also be confusing/annoying for users.
The text was updated successfully, but these errors were encountered: