facebook / facebook/lexical

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

Ouverte
#4,167 9 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
selection
Langage dominant
TypeScript
Étoiles
23.9k
Forks
2.2k
Merge moyen
1 j 14 h
PR mergées (30 j)
55

Description

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.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.