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

Selection.extract fix #2620

Merged
merged 2 commits into from
Jul 19, 2022
Merged

Selection.extract fix #2620

merged 2 commits into from
Jul 19, 2022

Conversation

acywatson
Copy link
Contributor

@acywatson acywatson commented Jul 9, 2022

I think there's some additional weirdness in Selection.extract around partial selection and text splitting (looking at the code, it seems not all the cases are covered), but I think this is more correct than before. Basically, if only a single node is selected and the selection is collapsed, we don't need to worry about splitting or anything - just return that node.

EDIT:

Changing the way extract works caused some tests to fail. Basically, I think this was a "load-bearing bug". There was some weird behavior around toggling links with collapsed Selections (it would usually make the one side of the text a link, which is not consistent with how other editors work). I fixed this by basically making toggling links on a collapsed selection do nothing. In the future, we could improve this by inserting a link at that spot, like GDocs and Quip do, but that behavior actually seems weird to me.

Fixes #2614

@vercel
Copy link

vercel bot commented Jul 9, 2022

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

Name Status Preview Updated
lexical ✅ Ready (Inspect) Visit Preview Jul 19, 2022 at 5:04AM (UTC)
lexical-playground ✅ Ready (Inspect) Visit Preview Jul 19, 2022 at 5:04AM (UTC)

@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 Jul 9, 2022
@acywatson acywatson merged commit df80ecd into main Jul 19, 2022
lateefazeez pushed a commit to lateefazeez/lexical that referenced this pull request Jul 20, 2022
* Selection.extract sfix

* fix tests
@thegreatercurve thegreatercurve deleted the #2614 branch July 28, 2022 07:34
thegreatercurve pushed a commit that referenced this pull request Nov 25, 2022
* Selection.extract sfix

* fix tests
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.

Bug: Link toggle doesn't work when it is in the end of a paragraph
3 participants