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

Update anchor selection if split by patching style #5087

Conversation

Piliuta
Copy link
Contributor

@Piliuta Piliuta commented Oct 5, 2023

Problem

Setting styles using $patchStyleText does not update the selection when the anchor node is split. This causes the selection to contain a node that is not part of the selection. As a result, the toolbar/$getSelectionStyleValueForProperty is not able to determine the correct selection style.

Screen.Recording.2023-10-05.at.18.48.34.mov

Solution

Update the selection anchor with the new text node after splitting.

Screen.Recording.2023-10-05.at.18.52.00.mov

@vercel
Copy link

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

@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 Oct 5, 2023
@Piliuta
Copy link
Contributor Author

Piliuta commented Oct 5, 2023

Failed tests seem spurious 😏

@Sparky338 Sparky338 merged commit 6d568d6 into facebook:main Oct 18, 2023
@Piliuta Piliuta deleted the update-anchor-selection-after-patching-range-selection branch October 19, 2023 08:11
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.

4 participants