Skip to content

Conversation

@mattConnHarbour
Copy link
Contributor

No description provided.

@linear
Copy link

linear bot commented Feb 3, 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: 6410f8173b

ℹ️ 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 on lines 221 to +227
const handleReject = () => {
// Check for custom handler that replaces default behavior entirely
const customHandler = proxy.$superdoc.config.onTrackedChangeBubbleReject;
if (props.comment.trackedChange && typeof customHandler === 'function') {
customHandler(props.comment, proxy.$superdoc.activeEditor);
return;
}

Choose a reason for hiding this comment

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

P2 Badge Keep dialog cleanup when using custom reject handler

When a custom tracked-change handler is configured, this early return skips the nextTick cleanup that clears activeComment and bumps commentsStore.lastUpdate. That means accepting/rejecting via the custom handler leaves the bubble UI open and the active comment pinned even if the handler resolves the change, because the handler signature only receives (comment, editor) and has no access to the internal store to clear it. Consider running the cleanup regardless of whether a custom handler is used (same issue applies to the accept handler).

Useful? React with 👍 / 👎.

Copy link
Collaborator

Choose a reason for hiding this comment

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

looks important @mattConnHarbour

Copy link
Collaborator

@harbournick harbournick left a comment

Choose a reason for hiding this comment

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

I think its a cool idea and looks like a clean implementation. @mattConnHarbour please add unit tests to this covering the new api, as well as documentation

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.

clean implementation - just address the comments (incld Codex's) and feel free to merge after that

};

const handleReject = () => {
// Check for custom handler that replaces default behavior entirely
Copy link
Contributor

Choose a reason for hiding this comment

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

should we add tests for the custom handler paths? the existing tests at only cover default behavior

we could add a case where config.onTrackedChangeBubbleAccept is set and verify it's called instead of the default

onFontsResolved: null,

// Tracked change bubble handlers - replace default accept/reject behavior
// Only fires from bubble buttons, not toolbar or context menu
Copy link
Contributor

Choose a reason for hiding this comment

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

should we document that the default behavior includes resolving the comment and clearing active state?

users might not realize they need to handle these themselves - maybe add an example showing the full flow?


const handleReject = () => {
// Check for custom handler that replaces default behavior entirely
const customHandler = proxy.$superdoc.config.onTrackedChangeBubbleReject;
Copy link
Contributor

Choose a reason for hiding this comment

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

new handlers should be added to apps/docs/core/superdoc/configuration.mdx, e.g.

 <ParamField path="onTrackedChangeBubbleAccept" type="function">
   Custom handler for accepting tracked changes from comment bubbles.
   Replaces default behavior entirely when provided.

   ```javascript
   onTrackedChangeBubbleAccept: (comment, editor) => {
     // Your custom logic here
     editor.commands.acceptTrackedChangeById(comment.commentId);
     await saveDocument(); // e.g., custom save after accept
   }

   Only fires from bubble buttons, not toolbar or context menu

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