Skip to content

feat: add visual indication for tracked change, comments and nested comments#1770

Merged
harbournick merged 27 commits intomainfrom
caio/sd-1519-add-visual-highlight-for-comment-ranges-when-comment-is
Jan 21, 2026
Merged

feat: add visual indication for tracked change, comments and nested comments#1770
harbournick merged 27 commits intomainfrom
caio/sd-1519-add-visual-highlight-for-comment-ranges-when-comment-is

Conversation

@caio-pizzol
Copy link
Copy Markdown
Contributor

@caio-pizzol caio-pizzol commented Jan 16, 2026

Tracked change, comments and nested comments visual indication

Prev:
Captura de Tela 2026-01-17 às 09 50 18

Now:
Captura de Tela 2026-01-17 às 09 51 07

@linear
Copy link
Copy Markdown

linear Bot commented Jan 16, 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: dde7bcc58d

ℹ️ 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".

Comment thread packages/layout-engine/painters/dom/src/renderer.ts
Comment thread packages/super-editor/src/core/PresentationEditor.ts Outdated
@caio-pizzol caio-pizzol marked this pull request as draft January 16, 2026 22:40
@caio-pizzol caio-pizzol marked this pull request as ready for review January 16, 2026 22:52
@caio-pizzol caio-pizzol self-assigned this Jan 16, 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: acd496d171

ℹ️ 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".

Comment thread packages/super-editor/src/extensions/comment/comments-helpers.js
@caio-pizzol caio-pizzol force-pushed the caio/sd-1519-add-visual-highlight-for-comment-ranges-when-comment-is branch from acd496d to 835f839 Compare January 17, 2026 10:29
@caio-pizzol caio-pizzol marked this pull request as draft January 17, 2026 11:02
… precedence

Add regression tests for getActiveCommentId behavior:
- Returns innermost comment when cursor is in nested range
- Returns outer comment when cursor is outside inner range
- Comments take precedence over tracked changes at same position
- TC ID returned when only TC exists at cursor position
- Three levels of nested comments handled correctly
- Returns null when cursor is outside all comments
- Adjacent non-overlapping comments identified correctly
Add regression tests for trackedChangeParentId vs parentCommentId:
- Comment on TC text gets trackedChangeParentId but no parentCommentId
- Threaded comment in TC has both trackedChangeParentId (for bubble)
  and parentCommentId (for threading)
- Parent spanning outside TC has no trackedChangeParentId
…hanges

Refactor getActiveCommentId to:
- Build a map of all comment ranges in the document
- Find which comments contain the cursor position
- Return the innermost comment (smallest range) when nested
- Check for comments first, fall back to TC only if no comment found
Add trackedChangeParentId field to track TC association separately from
comment threading. This allows:
- Comments on TC text to appear as separate bubbles (not nested under TC)
- Reply threading to work correctly via parentCommentId
- Proper visibility toggling based on TC vs comment association
- Correct export with proper range positions

Files updated:
- documentCommentsImporter: add trackedChangeParentId field
- comment-import-helpers: check trackedChangeParentId for TC detection
- comments-helpers: use trackedChangeParentId for export positioning
- use-comment: pass trackedChangeParentId through
- comments-store: use trackedChangeParentId for visibility check
Previously, comments on TC text were skipped for background highlighting
because they had trackedChange=true. Now all comments get proper
background-color highlight regardless of TC association.

Update test to verify comments on TC text receive highlighting.
Synthetic comments created for tracked changes (with trackedChange=true)
should not be exported to comments.xml as they are UI-only representations.
@caio-pizzol caio-pizzol marked this pull request as ready for review January 17, 2026 12:48
@caio-pizzol caio-pizzol changed the title feat: add visual highlight for comment ranges feat: add visual indication for tracked change, comments and nested comments Jan 17, 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: ef5991d04c

ℹ️ 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".

Comment thread packages/layout-engine/painters/dom/src/renderer.ts Outdated
Comment thread packages/super-editor/src/extensions/comment/comments-plugin.js
this.activeCommentId = commentId;
// Force re-render of all pages by incrementing layout version
// This bypasses the virtualization cache check
this.layoutVersion += 1;
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.

From a performance perspective, is there a way to limit the re-rendering to only comment marks, or only pages with comments?

Not a blocker, but just curious.

@palmer-cl
Copy link
Copy Markdown
Collaborator

Code looks good, but a couple of UX questions.

It looks like we removed the threading for tracked changes, but this could be purposeful. In my conversation with @missysuperdoc we want to deviate slightly from the Word functionality and thread comments under tracked changes, for example like this (from superdoc.dev)

image

When I now add that same doc on this branch, it looks like this we see all of the bubbles are now separated:

image

@palmer-cl
Copy link
Copy Markdown
Collaborator

I see the same behavior with a document initiated in google docs.

Current main:

image

On this branch:

image

@harbournick harbournick merged commit 8eb07e4 into main Jan 21, 2026
3 of 4 checks passed
@harbournick harbournick deleted the caio/sd-1519-add-visual-highlight-for-comment-ranges-when-comment-is branch January 21, 2026 21:52
harbournick pushed a commit that referenced this pull request Jan 21, 2026
# [1.8.0-next.11](v1.8.0-next.10...v1.8.0-next.11) (2026-01-21)

### Features

* add visual indication for tracked change, comments and nested comments ([#1770](#1770)) ([8eb07e4](8eb07e4))
@harbournick
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 1.8.0-next.11 🎉

The release is available on:

Your semantic-release bot 📦🚀

harbournick pushed a commit that referenced this pull request Jan 21, 2026
# [1.8.0](v1.7.0...v1.8.0) (2026-01-21)

### Bug Fixes

* add addToHistory to new insertTrackedChange command ([#1767](#1767)) ([e5081be](e5081be))
* annotation drop ([#1789](#1789)) ([f384213](f384213))
* annotation selection ([#1762](#1762)) ([1c831cc](1c831cc))
* annotation selection, applying formatting ([#1784](#1784)) ([924af4b](924af4b))
* guard against null editor ref in telemetry handler ([#1763](#1763)) ([16b3a9a](16b3a9a))
* **layout:** default missing lineRule to auto for OOXML line spacing ([d0fd582](d0fd582))
* preserve nested comment ranges on export (SD-1518) ([#1765](#1765)) ([9b81f9a](9b81f9a))
* reorganize style resolution in the layout engine (SD-1411) ([#1786](#1786)) ([1845b76](1845b76))
* **search:** preserve leading/trailing whitespace in flexible matches ([#1788](#1788)) ([c5d6751](c5d6751))
* trigger release ([f826636](f826636))

### Features

* add insertTrackedChange programmatic shortcut ([#1761](#1761)) ([cd0628e](cd0628e))
* add visual indication for tracked change, comments and nested comments ([#1770](#1770)) ([8eb07e4](8eb07e4))
* comment anchor helpers ([#1796](#1796)) ([595bdc6](595bdc6))
* comment highlight config ([#1798](#1798)) ([aa7e957](aa7e957))
* **comments:** add position-ordered comments getter ([#1774](#1774)) ([bdac914](bdac914))
* include non-breaking spaces in search ([#1768](#1768)) ([d2784b9](d2784b9))
* search cross block anchor ([#1799](#1799)) ([09efa63](09efa63))
* view options print and web ([#1793](#1793)) ([82adcb1](82adcb1))
@harbournick
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 1.8.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

3 participants