Skip to main content
onReady passes you a ReviseEditorHandle. Store it in a ref. Every controller on it is stable for the life of the component.

Routing

Document-local controllers act on the active document. Each one can be bound to a specific document instead:
Scoped controllers: tools, toolbar, review, view, zoom, selection, agent, comments.

documents

Promise<ReviseDocumentHandle>
Opens and parses a document. { activate: false } loads it in the background.
boolean
boolean
ReviseDocumentHandle | null
ReviseDocumentHandle
As get, but throws instead of returning null.
string | null
ReviseOpenDocument[]
ReviseDocumentCollectionState
() => void

tools

ReviseEditorToolDefinition[]
Native document-local tool schemas, without the delegation tool. Hand these to your own model. editor.getToolDefinitions() returns the same tools with an execute function each, plus revise_run_agent when an agent is configured.
Promise<ReviseToolResult<Name>>
Typed inputs from the shared tool contract. Expected failures return { ok: false }. Options: { documentId?, directMode? }. context_notes, which a model uses to carry context between reads, is optional here and defaults to "N/A".
Promise<ReviseToolResult<string>>
For untrusted model-provided calls, browser-only tools (get_selection, view_image, revise_run_agent), and model-facing document_id routing.
Promise<ReviseToolResponse<Name>>
Returns the successful response, or throws ReviseToolError.
Promise<Blob>
Promise<Blob>
Export as "docx" (default), "pdf", "html", "markdown", or "txt". With mode: "review" (default) a .docx keeps pending tracked changes and comments, and other formats show the text with changes accepted. mode: "final" accepts every pending change and drops comments first — a clean copy. See export.
ReviseSuggestionDecision
ReviseSuggestionDecision

toolbar

ReviseToolbarState
Live selection formatting, block type, undo/redo availability, and review counts.
void
setActiveTab switches the ribbon’s row. The SDK has no tab strip for the ribbon, so connect your own controls to toolbar.setActiveTab("layout" | "insert" | "review" | "edit"). Page and section breaks are on the Layout row. The SDK has no Tools row. Get word and character counts from editor.getStatistics().
Commands return false when they cannot apply.

view

Title, document mode, comments panel, and review panel.
ReviseViewState
{ ready, title, documentMode, readOnly, commentsOpen, commentCount, reviewOpen, reviewTargetCount }
void
void
void
void

review

ReviseReviewState
Open state, target counts, suggestion IDs, active comment, display mode, and every comment thread.
ReviseTrackedChange[]
Every pending change with kind, author, authorType, createdAt, blockIds, insertedText/deletedText, and description. It is not part of the subscribed state. Each call reads the document once. See building your own review panel.
ReviseTrackedChange | null
One change, or null after it is resolved.

selection

ReviseSelectionSnapshot
() => void
ReviseSelectionCapture | null
Saves the selection so it survives focus moving into your UI. Returns null when nothing is selected.
ReviseSelectionRestoreResult
Returns a typed failure when the document has changed since the capture.
void

zoom

{ zoom, scale }
void
() => void

agent

Promise<ReviseAgentRunResult>
boolean
Send guidance to a run in progress.
void
() => void

comments

Agent runs scoped to a single comment thread.
Promise<CommentAgentRunResult>
boolean
void
CommentAgentRunState | undefined
() => void
Publishes a map of every run in progress.

collaboration

Presence and sync state for a shared document. See collaboration.
ReviseCollaborationState
{ enabled, synced, peers }. peers lists everyone in the room, including the local participant (isLocal: true), each with the color their caret is drawn in. Empty when no awareness was supplied.
() => void
Fires on join, leave, caret movement, and sync-state changes.

Convenience

Shorthands that act on the active document unless given an ID.
onReady fires before any document exists. Subscriptions can be added immediately and attach when a document opens. Calls that act on a document throw until one is open. Wait for onDocumentReady, or await editor.whenReady().
getStatistics() counts are computed without a layout pass, so they are safe to call per keystroke behind a debounce. Counts follow the markup view, as in Word: pending insertions count and pending deletions do not. In the "original" suggestion view mode, counts use the text as if all suggestions were rejected. editor.document(id).getStatistics() takes no argument.