facebook / facebook/lexical

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

Đang mở
#4,167 9 bình luận 0 reaction 0 người được giao Xem trên GitHub
selection
Ngôn ngữ chính
TypeScript
Star
23.9k
Fork
2.2k
Merge trung bình
1 ngày 14 giờ
Pull request đã merge (30 ngày)
55

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.