Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mutations to respect canInsertBeforeAfter #4553

Merged
merged 5 commits into from
May 25, 2023
Merged

Mutations to respect canInsertBeforeAfter #4553

merged 5 commits into from
May 25, 2023

Conversation

zurfyx
Copy link
Member

@zurfyx zurfyx commented May 25, 2023

We're usually very lenient when it comes to composition (as it can break easily) and we don't touch it unless it's imprescindible.

However, Mutations as they're now are breaking the canInsert{Before/After} rules which directly impacts things like Mentions or TabNode. This PR forbids Mutations that violate this rule and will instead fallback to input.

The other question is whether TabNode has to implement canInsert{Before/After} or we can do something smarter with it.

This PR also adjusts the behavior for MentionNode, which also makes me think whether this canInsert rule should be automatically applied when there's segmentation as I can't think why it would make sense to allow characters at the end when segmentation implies that the Node will be recreated as soon as you type on it.

Fixes #4547

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 25, 2023
@vercel
Copy link

vercel bot commented May 25, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 25, 2023 6:58pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 25, 2023 6:58pm

@github-actions
Copy link

github-actions bot commented May 25, 2023

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
packages/lexical/dist/Lexical.js 27.79 KB (0%) 556 ms (0%) 204 ms (+4.44% 🔺) 760 ms
packages/lexical-rich-text/dist/LexicalRichText.js 38.74 KB (0%) 775 ms (0%) 402 ms (-27.74% 🔽) 1.2 s
packages/lexical-plain-text/dist/LexicalPlainText.js 38.72 KB (0%) 775 ms (0%) 278 ms (+41.8% 🔺) 1.1 s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
3 participants