facebook / facebook/lexical

Bug: TextNode in Token mode gets split when format is changed on portion of its text

Offen
#4,167 9 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
selection
Vorherrschende Sprache
TypeScript
Sterne
23.9k
Forks
2.2k
Ø Merge
1 T. 14 Std.
Gemergte PRs (30 T.)
55

Beschreibung

Lexical version: 0.9.0

## Steps To Reproduce

1. Open a modified `MentionsPlugin` example that simply uses `RichTextEditor` instead of `PlainTextEditor`
2. Create a mention node by entering `@Ham` and selecting `@Hammerhead`.
3. Select a portion of the newly created node (e.g. `mer`), press Cmd/Ctrl+B to bold the selected text
4. Observe that the node that's supposed to be a token gets incorrectly split into multiple nodes

Link to code example:

https://codesandbox.io/s/purple-river-pmc11v

## The current behavior
Applying format to a range selection does not respect boundaries of text nodes in token mode.
image

## The expected behavior
`RangeSelection`'s `formatText` method (and likely other methods) should not invoke `splitText` on "token" text nodes.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.