This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/document-authoring/review-and-collaboration/tracked-changes-and-editor-modes.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Use tracked changes and editor modes in Document Authoring

Before you start, install Nutrient Document Authoring SDK and load it in your app. If you haven’t set it up, refer to the getting started guide.

Nutrient Document Authoring SDK supports tracked changes for review workflows. Authorized users create tracked revisions, inspect tracked changes, and accept or reject them in the editor.

The example code omits error handling. Add error handling before you use this code in production.

Understand the editor modes

Nutrient Document Authoring SDK supports three editor modes:

  • edit — Changes apply directly, while existing tracked changes remain visible.
  • review — New edits are recorded as tracked revisions, while tracked changes remain visible.
  • view — Editing is disabled, while tracked changes remain visible.

Use editor.getEditorMode() to inspect the current mode:

const mode = editor.getEditorMode();
console.log(mode);

Switch modes at runtime

Use editor.setEditorMode(mode) to move between editing states:

editor.setEditorMode('edit');
editor.setEditorMode('review');
editor.setEditorMode('view');

Use separate modes when your application needs separate drafting, review, and read-only steps.

Create tracked changes in review mode

When the editor is in review mode, supported edits are recorded as tracked changes instead of applying directly:

editor.setAuthor('Jane Reviewer');
editor.setEditorMode('review');

After switching to review mode, supported editor changes are recorded as revisions for the current author.

Set the author used for tracked changes

Use editor.setAuthor(name) to control the author name used for new tracked changes, comments, and replies:

editor.setAuthor('Legal Team');

Read the current author with editor.getAuthor():

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

Clear the author name to use the default anonymous label:

editor.setAuthor('');

Review and resolve tracked changes in the UI

Review tracked changes directly in the editor UI. Revisions can show inserted content, deleted content, and supported formatting or document property changes.

Users with permission can inspect each revision and accept or reject it in the editor.

Choose a review task

Refer to these guides to control review in your application:

Use tracked changes with Document Authoring AI

Document Authoring AI uses the same editor modes as the rest of the editor. Your app decides how AI write operations apply:

  • In edit mode, AI writes can apply immediately.
  • In review mode, AI writes can use tracked changes. Authorized users can accept or reject them.
  • In view mode, AI writes are blocked. Read-only AI tools can still inspect the document.

Set the editor author before you run AI writes in review mode. This attributes tracked changes to the right user or team. For AI-specific policy and writeMode: "track_changes" examples, refer to the review and approval in Document Authoring AI guide.

Use review transactions together with programmatic editing

Use review transactions to create tracked revisions from code with DocAuthDocument.transaction(). Supported changes are recorded as revisions for the supplied author. Changes that tracked-change markup can’t represent apply directly and don’t create revisions.

const currentDoc = editor.currentDocument();
await currentDoc.transaction(
async ({ draft }) => {
const paragraph = draft.body().content().addParagraph();
paragraph.asTextView().setText('This change is authored in review mode.');
return true;
},
{
review: {
author: 'Nutrient Docs',
},
},
);

For revision queries and decisions, refer to the manage tracked changes programmatically guide. For the transaction model, refer to the programmatic editing guide.

Learn more

Use these references for related review and editing workflows: