Skip to content

Decoration range incorrectly expands to run boundaries; highlight can be lost after mark changes#2173

Merged
caio-pizzol merged 12 commits into
mainfrom
vlada/sd-1963
Feb 27, 2026
Merged

Decoration range incorrectly expands to run boundaries; highlight can be lost after mark changes#2173
caio-pizzol merged 12 commits into
mainfrom
vlada/sd-1963

Conversation

@VladaHarbour
Copy link
Copy Markdown
Contributor

No description provided.

@linear
Copy link
Copy Markdown

linear Bot commented Feb 25, 2026

Copy link
Copy Markdown

@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: 6b257e52bd

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/super-editor/src/core/presentation-editor/dom/DecorationBridge.ts Outdated
Copy link
Copy Markdown
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.

good approach - splitting runs at decoration boundaries feels like the right approach.

please check inline comments especially collectDecorationRanges one

Comment thread packages/super-editor/src/core/presentation-editor/dom/DecorationBridge.ts Outdated
Comment thread packages/super-editor/src/core/presentation-editor/PresentationEditor.ts Outdated
@harbournick
Copy link
Copy Markdown
Collaborator

@VladaHarbour mind addressing Caio's comments first? thank you!

@VladaHarbour
Copy link
Copy Markdown
Contributor Author

@VladaHarbour mind addressing Caio's comments first? thank you!

Hi @harbournick! Added my fixes

Copy link
Copy Markdown
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.

@VladaHarbour all 6 comments from round 1 are addressed, nice work on the shared helper and the split-runs tests. left two inline comments: one real bug in the !restoreEmptyDecorations branch that causes redundant repaints (easy one-liner), and one question about test coverage for the same-position guard.

Comment thread packages/super-editor/src/core/presentation-editor/dom/DecorationBridge.ts Outdated
Copy link
Copy Markdown
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.

@VladaHarbour all feedback from rounds 1 and 2 is addressed. added behavior tests (Playwright) covering the core SD-1963 scenarios — comment highlights and track-change decorations surviving bold/italic/underline application. lgtm, approving.

When italic is applied to part of a commented range, the run splits
and the highlight spans multiple DOM elements. Assert by commentId
and individual text fragments instead of the full contiguous text.
@caio-pizzol caio-pizzol merged commit 08ffc41 into main Feb 27, 2026
7 checks passed
@caio-pizzol caio-pizzol deleted the vlada/sd-1963 branch February 27, 2026 18:46
@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Feb 27, 2026

🎉 This PR is included in superdoc v1.17.0-next.37

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Feb 27, 2026

🎉 This PR is included in superdoc-cli v0.2.0-next.32

The release is available on GitHub release

gpardhivvarma pushed a commit to gpardhivvarma/superdoc that referenced this pull request Mar 2, 2026
… be lost after mark changes (superdoc-dev#2173)

* fix: separate logic for decoration sync in presentation editor

* fix: move from overlay approach to paragraph splitting

* fix: clear selection

* fix: prevent highlighted decoration position shift

* fix: remove console.log

* fix: decoration restore condition

* fix(super-editor): compose decoration remap so external highlights track replacement and mark split

* fix: logic improvements

* fix: create shared helper for repeated code

* fix: update tests and address comments

* test: add behavior tests for decoration survival after mark changes

Playwright tests covering SD-1963: comment highlights and track-change
decorations must persist when the user applies bold/italic/underline to
overlapping or partially-overlapping text.

* fix(test): check comment highlight by id after run split

When italic is applied to part of a commented range, the run splits
and the highlight spans multiple DOM elements. Assert by commentId
and individual text fragments instead of the full contiguous text.

---------

Co-authored-by: Matthew Connelly <matthew@harbourshare.com>
Co-authored-by: Nick Bernal <nick@superdoc.dev>
Co-authored-by: Caio Pizzol <caio@harbourshare.com>
@harbournick
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in superdoc v1.17.0

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 11, 2026

🎉 This PR is included in superdoc-cli v0.2.0

The release is available on GitHub release

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.

5 participants