Skip to content

fix(links): link styles should be removed when tracked change is rejected#2465

Open
palmer-cl wants to merge 2 commits intomainfrom
colep/sd-2251-bug-rejecting-a-hyperlink-tc-does-not-remove-the-hyperlink
Open

fix(links): link styles should be removed when tracked change is rejected#2465
palmer-cl wants to merge 2 commits intomainfrom
colep/sd-2251-bug-rejecting-a-hyperlink-tc-does-not-remove-the-hyperlink

Conversation

@palmer-cl
Copy link
Collaborator

  • Fixed tracked-change reject for hyperlink suggestions so rejecting a suggested link removes both the link mark and transient hyperlink styling

  • Hardened layout invalidation by including hyperlink/underline/strike in diff and cache keys, so reject/apply formatting changes always trigger correct re-rendering instead of stale cached runs.

@linear
Copy link

linear bot commented Mar 19, 2026

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8289f71cdc

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Copy link
Contributor

@caio-pizzol caio-pizzol left a comment

Choose a reason for hiding this comment

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

@palmer-cl nice fix — removing "after" marks before restoring "before" marks is clean and the overlap matcher fills a real gap. no correctness issues. tests are solid across all layers. left a couple inline suggestions on duplicated code and one note on visual test coverage.

newTr.addMark(Math.max(step.from, pos), Math.min(step.to, pos + node.nodeSize), step.mark);

const allowedMarks = ['bold', 'italic', 'strike', 'underline', 'textStyle', 'highlight'];
const allowedMarks = ['bold', 'italic', 'strike', 'underline', 'textStyle', 'highlight', 'link'];
Copy link
Contributor

Choose a reason for hiding this comment

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

this same list exists in removeMarkStep.js:39 — move it to constants.js so there's one place to update. this PR already had to change both.

const text = 'text' in run && typeof run.text === 'string' ? run.text : '';

// Include formatting marks that affect measurement (mirroring paragraph approach)
// Include formatting marks that affect visual output (mirroring paragraph approach).
Copy link
Contributor

Choose a reason for hiding this comment

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

this block is copy-pasted at line ~300. a small helper would mean future additions (like the underline/strike/link ones in this PR) only need one edit. worth it?

@@ -0,0 +1,68 @@
import { test, expect, type SuperDocFixture } from '../../fixtures/superdoc.js';
Copy link
Contributor

Choose a reason for hiding this comment

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

the behavior test checks state, but since the bug was about link styling staying visible, a visual screenshot test (like the existing reject-mixed-track-format.spec.ts) would catch pixel-level regressions too. worth adding?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants