This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/document-authoring/editing-and-review/comments-and-review-workflows.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Review documents with comments in Document Authoring

Before you start, ensure the Document Authoring library is installed and running. Refer to the getting started guide.

Document Authoring includes built-in comment workflows for review. Comments anchor to document text and appear beside the document. Reviewers can add comments from the toolbar or context menu, reply in threads, edit comment text, resolve discussions, reopen resolved threads, and delete comments when they’re no longer needed.

The example code omits error handling. Add it before using this code in production.

Set the author when creating the editor

Use UIOptions.author to set the author name used for new comments, replies, and tracked changes:

const editor = await docAuthSystem.createEditor(
document.getElementById('editor'),
{
ui: {
author: 'Jane Reviewer',
},
},
);

If you don’t provide an author name, comments use a localized anonymous label.

Change the author at runtime

Use editor.setAuthor(name) to update the current author when the active user changes:

editor.setAuthor('Legal Team');

Read the current author with editor.getAuthor():

const currentAuthor = editor.getAuthor();
console.log(currentAuthor);

Clear the current author to fall back to the anonymous label:

editor.setAuthor('');

Add comments in the editor UI

To add a comment in the editor:

  1. Select the text to review.
  2. Add a comment from the toolbar or context menu.
  3. Enter the comment text.

The comment attaches to the selected text and appears in the document’s comment thread list.

Reply to and manage comment threads

Document Authoring supports threaded comment discussions. Reviewers can:

  • Reply to an existing comment thread
  • Edit comment or reply text
  • Resolve a thread when the discussion is complete
  • Reopen a resolved thread if more review is needed
  • Delete a comment thread

This keeps document discussions anchored to the exact text under review.

Use comments together with programmatic review flows

Use the programmatic document API inside a transaction to inspect or manage comment threads in code. For example, query open threads with draft.commentThreads(), add replies, or resolve threads programmatically:

const currentDoc = editor.currentDocument();
await currentDoc.transaction(async ({ draft }) => {
const openThreads = draft.commentThreads().all({ status: 'open' });
for (const thread of openThreads) {
thread.reply('Reviewed by automation.');
thread.resolve();
}
return true;
});

For a full walkthrough of the transaction API, refer to the programmatic editing guide.

Learn more