Revise Editor SDK menu

Roles and permissions

Restrict editor capabilities per participant or per document.

A mode (editing, suggesting, viewing) can be switched at runtime; a role constrains which modes and actions are allowed and cannot be escalated from inside the editor.

TSX
<ReviseEditor
  role="suggester"
  initialDocuments={[
    { id: "contract-1", source: file },
    { id: "exhibit-a", source: exhibit, role: "viewer" }, // per-document override
  ]}
/>
RoleEditsDirect editsAccept / rejectComments
editor (default)YesYesYesYes
suggesterTracked suggestions onlyNoNoYes
viewerNoNoNoNo

suggester cannot accept or reject suggestions (accepting a suggestion applies a direct edit). Suggesters can still navigate review, preview accept/reject, and comment.

Enforcement#

  • Modes & toolbar: setDocumentMode() clamps to allowed modes (requesting "editing" as a suggester sets "suggesting" and reports it to onDocumentModeChange).
  • Built-in chrome: Hides the mode toggle when only one mode is allowed, omits accept/reject buttons from the ribbon, and hides inline suggestion tooltips.
  • Handle: review.accept*() / reject*() return false or mark all IDs unresolved. Comment mutations no-op for viewer.
  • Agent tools: tools.execute() returns { ok: false, error: { code: "role_not_permitted" } } for mutations disallowed by viewer and for directMode: true calls under suggester (without directMode, the call produces a tracked suggestion). Delegated agent.run() validates before starting and throws ReviseRoleError.
TypeScript
import { ReviseRoleError } from "revise";

const result = await editor.tools.execute("replace", input, { directMode: true });
if (!result.ok && result.error.code === "role_not_permitted") {
  // Direct edits are rejected for suggesters.
}

try {
  await editor.agent.run(task, { directMode: true });
} catch (error) {
  if (error instanceof ReviseRoleError) {
    // error.role === "suggester", error.action === "apply changes directly"
  }
}

Read the role#

TypeScript
editor.getRole();            // active document
editor.getRole("exhibit-a"); // specific document

Roles are client-side UI and API guardrails, not authorization. In a collaborative room, assign roles on your server and reject unauthorized writes at your sync transport.