Skip to content

Conversation

@financialvice
Copy link

Exposes a public scrollToComment method for custom comment UIs.\n\nTests: pnpm -C packages/superdoc test -- SuperDoc.test.js

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: 67a14fef99

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

if (!commentsConfig || commentsConfig === false) return false;
if (!commentId || typeof commentId !== 'string') return false;

const element = document.querySelector(`[data-thread-id="${commentId}"]`);

Choose a reason for hiding this comment

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

P2 Badge Scope comment lookup to the SuperDoc container

Because document.querySelector searches the whole page, this new API will scroll to the first matching data-thread-id across all SuperDoc instances. If two editors load documents with overlapping thread ids (e.g., separate docs both have comment-1), calling scrollToComment on one instance can scroll the other instance instead. You already expose this.element as the container; scoping the lookup to that element avoids cross-instance collisions.

Useful? React with 👍 / 👎.

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.

1 participant