Skip to content

Proposal/clear link tool state#3000

Open
akulistus wants to merge 13 commits into
nextfrom
proposal/clear-link-tool-state
Open

Proposal/clear link tool state#3000
akulistus wants to merge 13 commits into
nextfrom
proposal/clear-link-tool-state

Conversation

@akulistus

@akulistus akulistus commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Fixes issue (#2979 (comment)) preventing text unlinking by clicking link popover item block in toolbar.

Comment on lines +417 to +418
* Checks if the current selection range starts outside
* of a popover item element

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ideally, link tool should not know about Popover and its implementation. Explain, why it is needed.

}

/**
* Calls instance clear function

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Describe the use case please.

Comment thread types/utils/popover/popover-item.d.ts Outdated
onActivate: (item: PopoverItemParams, event?: PointerEvent) => void;

/**
* Popover item clear handler

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same here

@akulistus
akulistus requested a review from neSpecc July 1, 2026 20:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a regression in the Link inline tool where clicking the unlink action while the link popover/input is open could close the popover without actually removing the link. It also updates the release metadata to ship the fix.

Changes:

  • Update LinkInlineTool.surround() to unlink only on an explicit link-tool click (vs. programmatic close scenarios).
  • Add Cypress coverage for unlinking via toolbar item click and for popover/selection interactions.
  • Bump patch version and add a changelog entry for the fix.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/components/inline-tools/inline-tool-link.ts Tracks explicit button clicks to distinguish unlink intent from programmatic popover closes.
test/cypress/tests/inline-tools/link.cy.ts Adds E2E coverage for unlink behavior and popover behavior during selection/tool changes.
package.json Bumps version to 2.31.7 for the patch release.
docs/CHANGELOG.md Documents the unlink fix in 2.31.7.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 178 to 182
const parentAnchor = this.selection.findParentTag('A');
const buttonClicked = this.BUTTON_CLICKED;

this.BUTTON_CLICKED = false;

Comment thread src/components/inline-tools/inline-tool-link.ts Outdated
Comment thread test/cypress/tests/inline-tools/link.cy.ts Outdated
Comment thread test/cypress/tests/inline-tools/link.cy.ts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants