Skip to main content

Documents

readonly ReviseDocumentInput[]
Documents to open on mount. Each needs a host-owned id and a source. The source field is named docx but accepts DOCX, Markdown, plain text, and HTML — see input formats. A document joining an established collaborative room needs no source at all.
string | null
Controlled active document. Pair with onActiveDocumentChange.
string | null
Initial active document for uncontrolled use. Defaults to the first document.

Behaviour

EditorUserIdentity | null
Identity attached to comments and suggestions the user authors.
"editor" | "suggester" | "viewer"
default:"\"editor\""
What this participant may do, across every open document; override per document with ReviseDocumentInput.role. Unlike defaultDocumentMode this is a boundary rather than a starting point — a suggester cannot reach editing mode, and agent tool calls that would edit directly are refused. See roles.
ReviseEditorSettings
Behavior settings. settings.trackedChanges.markupStyle: "word" switches the canvas to classic Word-style redlines (all revisions in red, insertions underlined, deletions struck through, no background tint); settings.trackedChanges.showRemovalsInReview: true starts review with deleted text visible inline. See tracked changes.
ReviseAgentConfig
Backend, credentials, model, or a custom transport for the delegated agent. See delegating to the Revise agent.
"editing" | "suggesting" | "viewing"
default:"\"editing\""
Seeds the mode for documents as they open. Not a controlled prop — use view.setDocumentMode() to change a live document.
number | 'fit-width'
default:"fit-width"
Initial zoom.
boolean
default:"true"
Whether the comments panel starts open.
boolean
default:"true"
Take keyboard focus when a document becomes active. Set false when the editor sits inside a larger page and should wait for a click.
boolean
default:"false"
Opt in to the Rust/WASM accelerations for word diff, agent text matching, and document statistics. The TypeScript implementations stay as the fallback, so this changes speed only, never behaviour. Off by default while it proves itself in the field.
readonly ReviseFontDefinition[]
Fonts added to the native picker. Loading the font files remains yours.

Chrome

"native" | "none"
default:"\"native\""
Render Revise’s ribbon, or nothing at all.
boolean
default:"true"
The bar above the ribbon: editable title, optional mode toggle, Review.
boolean
default:"false"
Built-in tab strip, one tab per open document.
"editor" | "browser"
default:"\"editor\""
Who handles Cmd/Ctrl+F. "editor" opens the built-in find-and-replace panel; "browser" leaves the shortcut to the browser’s native find, which suits an editor embedded in a longer page.
boolean
default:"false"
Show the Editing/Suggesting toggle in the title bar.
() => void
Adds a ”+” button to the tab strip. Without it, no button renders.

Appearance

"light" | "dark"
Scoped to this editor. Defaults to the host page’s theme.
string
The area behind the page. Any CSS background.
string
The paper itself. Any CSS colour.
string
The outline around each page. Any CSS colour.
string
React.CSSProperties

Callbacks

(editor: ReviseEditorHandle) => void
Fires once the editor is mounted. This is where you keep the handle.
(document: ReviseDocumentHandle) => void
Fires per document, once it has parsed and is ready to read or edit.
(documentId: string, document: ReviseDocument) => void
Any content change, from the user, your UI, or an agent. Debounce before persisting.
(state: ReviseDocumentCollectionState) => void
The open-document collection changed.
(documentId: string | null) => void
(documentId: string, title: string) => void
(documentId: string, mode: ReviseDocumentMode) => void
(documentId: string, zoom: ReviseZoom) => void
(documentId: string, event: ReviseAgentEvent) => void
(event: string, properties?) => void
The editor’s internal instrumentation — tool invocations, exports, review interactions — delivered to your own analytics. The SDK sends telemetry nowhere itself; this callback is the only place events go. Names and property shapes are internal and may change between versions.
(error: Error, documentId?: string) => void
Parse failures and runtime errors. Documents that fail to open also surface as status: "error" in the collection state.

Helpers

Promise<Blob>
A blank DOCX, for “New document” actions.