Skip to content

[lexical-link] Bug Fix: $toggleLink removes link when selection is collapsed - #8138

Merged
etrepum merged 3 commits into
meta:mainfrom
Senasiko:main
Feb 13, 2026
Merged

etrepum merged 3 commits into
meta:mainfrom
Senasiko:main

Conversation

@Senasiko

Copy link
Copy Markdown
Contributor

Description

This PR fixs an issue where, when the selection is collapsed, $toggleLink only affects the nearest TextNode

Before

before.mp4

After

after.mp4

@meta-cla meta-cla 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 Feb 12, 2026
@vercel

vercel Bot commented Feb 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview, Comment Feb 13, 2026 5:58pm
lexical-playground Ready Ready Preview, Comment Feb 13, 2026 5:58pm

Request Review

Comment on lines +688 to +693
if (selection.isCollapsed()) {
parentLink.getChildren().forEach((child) => {
parentLink.insertBefore(child);
});
parentLink.remove();
} else {

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.

it would probably be better to handle this outside of the nodes.forEach loop

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I made this change, please review again

@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Feb 13, 2026
@etrepum
etrepum added this pull request to the merge queue Feb 13, 2026
Merged via the queue into meta:main with commit 48a3711 Feb 13, 2026
36 checks passed
@janpe

janpe commented Feb 18, 2026

Copy link
Copy Markdown

Any idea when this fix might be seen in a release?

@etrepum

etrepum commented Feb 18, 2026

Copy link
Copy Markdown
Collaborator

It’s already in the nightly release, the monthly release is another week or two out.

rayterion pushed a commit to rayterion/lexical that referenced this pull request Feb 18, 2026
@etrepum etrepum mentioned this pull request Feb 25, 2026

This branch was successfully deployed

2 active deployments
Preview – lexical-playground — c61c2915 Deployed Feb 13, 2026 by vercel[bot]
Preview – lexical — c61c2915 Deployed Feb 13, 2026 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. extended-tests Run extended e2e tests on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants