facebook / facebook/lexical

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

Aperta
#4,167 9 commenti 0 reazioni 0 assegnatari Vedi su GitHub
selection
Lingua principale
TypeScript
Stelle
23.9k
Fork
2.2k
Merge medio
1g 14h
PR unite (30g)
55

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.