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

Fix tab replacement composition crash #5066

Merged
merged 1 commit into from
Oct 4, 2023
Merged

Fix tab replacement composition crash #5066

merged 1 commit into from
Oct 4, 2023

Conversation

zurfyx
Copy link
Member

@zurfyx zurfyx commented Sep 28, 2023

Composition on the entire node was hitting the "reuse" this same node part to render the new content (firstNode.spliceText(startOffset, delCount, text, true);). While it's a very optimal path that doesn't recreate the node and works well with composition tab node content should always strictly be \n. This PR forces it to recreate a new node, just like we do with token node, segmented, or other formatting edge cases.

This PR isn't ideal, the solution comes down to finding a generic solution for this issue: #5065

Chrome:
Works fairly well except that the cursor is not updated but it's a nit and doesn't affect functionality (the same functionality resembles if you select a range that includes plain text and bold)

Screen.Recording.2023-09-28.at.4.47.20.PM.mov

Firefox and Safari:
Adds an additional space in the beginning, likely because of different DOM nodes and some browser magic.

Screen.Recording.2023-09-28.at.4.48.48.PM.mov

@vercel
Copy link

vercel bot commented Sep 28, 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 Sep 29, 2023 3:54pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 29, 2023 3:54pm

@github-actions
Copy link

github-actions bot commented Sep 28, 2023

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
packages/lexical/dist/Lexical.js 28.29 KB (+0.08% 🔺) 566 ms (+0.08% 🔺) 359 ms (-17.18% 🔽) 925 ms
packages/lexical-rich-text/dist/LexicalRichText.js 39.58 KB (+0.08% 🔺) 792 ms (+0.08% 🔺) 785 ms (+73.71% 🔺) 1.6 s
packages/lexical-plain-text/dist/LexicalPlainText.js 39.56 KB (+0.08% 🔺) 792 ms (+0.08% 🔺) 393 ms (+26.93% 🔺) 1.2 s

@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 Sep 28, 2023
@acywatson acywatson merged commit af25259 into main Oct 4, 2023
40 of 43 checks passed
@acywatson acywatson deleted the tab-compo branch October 4, 2023 16:22
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
Development

Successfully merging this pull request may close these issues.

3 participants