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

[lexical-link] Bug Fix: Preserve the start/end of the selection for non-text points when creating a LinkNode #6883

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

etrepum
Copy link
Collaborator

@etrepum etrepum commented Nov 29, 2024

Description

When we are creating LinkNode elements from an existing RangeSelection the anchor or focus could be an element point, and in those cases we don't have good automatic handling of the selection when they get reparented so we end up with an invalid selection. This wraps that logic with a function that looks up the existing internal boundary nodes of the selection and preserves them for the LinkNode creation process.

Closes #2569

Test plan

Before

No unit tests

link-element-before.mov

After

Unit tests

link-element-after.mov

Copy link

vercel bot commented Nov 29, 2024

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 Nov 30, 2024 7:52pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 30, 2024 7:52pm

@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 Nov 29, 2024
Copy link

github-actions bot commented Nov 29, 2024

size-limit report 📦

Path Size
lexical - cjs 30.99 KB (0%)
lexical - esm 30.82 KB (0%)
@lexical/rich-text - cjs 39.76 KB (0%)
@lexical/rich-text - esm 32.63 KB (0%)
@lexical/plain-text - cjs 38.34 KB (0%)
@lexical/plain-text - esm 29.95 KB (0%)
@lexical/react - cjs 41.51 KB (0%)
@lexical/react - esm 34.06 KB (0%)

@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Nov 29, 2024
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. extended-tests Run extended e2e tests on a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Selection gets wrong after link created
2 participants