slash-editor
Guides

Comments

The comment mark plus a bring-your-own CommentThreadStore.

The comment mark anchors a thread id to a text range — nothing else. Thread bodies, authors, and resolution state never live in the document:

Prop

Type

The store must also expose subscribe(listener), which lets the React bindings update the sidebar when local or remote thread data changes.

interface CommentThread {
  id: string;
  status: "open" | "resolved";
  messages: CommentMessage[];
}
interface CommentMessage {
  id: string;
  author: string;
  body: string;
  createdAt: number;
}

Configure the store once

const store = createYourCommentThreadStore();
const editor = useSlashEditor({ blockKit: { comment: { store } } });
const comments = useComments(editor);

Core anchors comments in the document and owns the inline composer anchor. The store remains host-owned; it is not serialized into the document. unsetComment(threadId) removes that thread's anchors everywhere in the document, regardless of the selection, so removeAnchor works from a sidebar without moving the caret. It removes only that threadId's mark instances: ProseMirror's built-in unsetMark would strip every distinct thread anchored there, since the mark type sets excludes: "" so overlapping threads can coexist.

See Comment Panel for the rendered sidebar surface and the bubble toolbar composer.

On this page