facebook / facebook/lexical

Bug: Inconsistent behavior of `trimTextContentFromAnchor` on paste

Open
#3,775 2 comments 2 reactions 0 assignees View on GitHub
all-platforms-bug other
Dominant language
TypeScript
Stars
23.9k
Forks
2.2k
Avg merge
1d 14h
Merged PRs (30d)
55

Description

Lexical version: 0.7.6

## Steps To Reproduce

1. Open Lexical Playground with the "Max Length" setting on: https://playground.lexical.dev/?isMaxLength=true
2. Clear the editor
3. Paste some text longer than 30 character (the max length enforced with `MaxLengthPlugin` in Lexical Playground)
4. Clear the editor
5. Type any character, then repeat step 3.

At step 3. the pasted text is truncated at the maximum length.
At step 5. no text is pasted. `trimTextContentFromAnchor` reverts to the previous editor state.

My intuition is that the behavior at step 3. is correct.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.