[lexical][lexical-selection] Bug Fix: Treat all TabNode as if they are in token mode#7602
Merged
etrepum merged 4 commits intofacebook:mainfrom Jun 3, 2025
Merged
[lexical][lexical-selection] Bug Fix: Treat all TabNode as if they are in token mode#7602etrepum merged 4 commits intofacebook:mainfrom
etrepum merged 4 commits intofacebook:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
ivailop7
approved these changes
Jun 3, 2025
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
For legacy reasons TabNode is a 'normal' mode TextNode with the
IS_UNMERGEABLEdetail flag (used only in the reconciler's normalization), but the conditions in the rest of the core usednode.isToken()to determine if the node should be modified or replaced without checking theIS_UNMERGEABLEflag.To keep legacy serialization as-is, this PR changes the core to use
$isTokenOrTab(new) and$isTokenOrSegmentedfunctions instead of calling theTextNode.isTokenmethod directly, and these functions both now check$isTabNodeas part of their condition.This also changes all property setters of
__textto go through thesetTextContentmethod (except for@lexical/selection's$sliceSelectedTextNodeContentwhich is used in an unusual "read-only" way), and adds an additional invariant toTabNode.spliceTextto ensure that it is not modified by that either.Closes #7601
Test plan
Unit tests to confirm that
TabNodeis not modified in the scenarios from #7601