Skip to content

Attempt transform of NodeSelection to RangeSelection on mouseDown - #2901

Merged
zurfyx merged 4 commits into
mainfrom
fix2
Aug 29, 2022
Merged

zurfyx merged 4 commits into
mainfrom
fix2

Conversation

@zurfyx

@zurfyx zurfyx commented Aug 26, 2022

Copy link
Copy Markdown
Member

Different approach (old #2872) by levering mouse down.

Techical considerations:

  • The mousedown event alone is insufficient for to track the new selection. The DOM anchor/focus nodes will still be marked as null.
  • Mousedown + mouseup combination is unreliable. FF has a different order: Chrome/Safari: mousedown -> selectionchange -> mouseup; FF (sometimes): mousedown -> mouseup -> selectionchange
  • Since mousedown + selectionChange seems reliable across browsers I'm relying on this order in this PR.
Screen.Recording.2022-08-26.at.3.23.54.pm.mov

Closes #2856

@vercel

vercel Bot commented Aug 26, 2022 •

Copy link
Copy Markdown

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

Name Status Preview Updated
lexical ✅ Ready (Inspect) Visit Preview Aug 29, 2022 at 6:01PM (UTC)
lexical-playground ✅ Ready (Inspect) Visit Preview Aug 29, 2022 at 6:01PM (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 Aug 26, 2022

@trueadm trueadm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love it, so easy to follow too. Can you add the e2e for horizontal break to confirm it working again? Thanks!

This branch was successfully deployed

2 active deployments
Preview – lexical-playground — e52de50d Deployed Aug 29, 2022 by vercel[bot]
Preview – lexical — e52de50d Deployed Aug 29, 2022 by vercel[bot]
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: RangeSelection does not update when NodeSelection active

3 participants