Skip to main content

Documents

readonly ReviseDocumentInput[]
Documents to open on mount. Each needs a host-owned id and a source: DOCX, ODT, RTF, Markdown, plain text, or HTML (see input formats). docx is accepted as the older name for the same field. A document joining an established collaborative room needs no source.
string | null
Controlled active document. Pair with onActiveDocumentChange.
string | null
Initial active document for uncontrolled use. Defaults to the first document.

Behavior

EditorUserIdentity | null
Identity attached to comments and suggestions the user authors.
"editor" | "suggester" | "viewer"
default:"\"editor\""
What this participant may do in every open document. Override per document with ReviseDocumentInput.role. Unlike defaultDocumentMode, this is a limit, not a starting point: a suggester cannot switch to 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\""
The mode each document opens in. This is not a controlled prop. Use view.setDocumentMode() to change an open 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 remain the fallback, so this changes speed only, not behavior.
readonly ReviseFontDefinition[]
Fonts added to the native picker. Your app loads the font files.
(file: File, documentId: string) => Promise<string>
Store an image the user inserts, pastes, or drops, and resolve to the URL the document should reference — your CDN or object storage. Without it, images are embedded in the document as data URLs, which export into the .docx like any other image but make the document larger. A rejection shows the user a notice and reaches onError. Files over 10 MB are refused before upload.
(file: File, documentId: string) => void
Shows Import before Export in the ribbon, with a file picker for DOCX, ODT, RTF, Markdown, HTML, text, and XML, and accepts a document file dropped anywhere on the editor, with a “Drop to import” overlay. Image drops still insert images. The editor only collects the file: what importing means, such as opening it as a new document, is up to you.

Chrome

"native" | "compact" | "floating" | "none"
default:"\"native\""
"native" renders the full Revise ribbon. "compact" renders the everyday-formatting subset, centered, for narrow fixed-width hosts (about 760px). "floating" renders the full ribbon as a centered card over the canvas, as in the Revise app. "none" renders no toolbar.
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. Use "browser" when the editor is 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 color.
string
The outline around each page. Any CSS color.
string
React.CSSProperties

Callbacks

(editor: ReviseEditorHandle) => void
Fires once the editor is mounted. Store the handle here.
(document: ReviseDocumentHandle) => void
Fires once per document, after it has parsed and is ready to read or edit.
(documentId: string, document: ReviseDocument) => void
Fires on any content change, from the user, your UI, or an agent. Debounce before saving.
(state: ReviseDocumentCollectionState) => void
Fires when the set of open documents changes.
(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. These events leave the page only through this callback. Names and property shapes are internal and may change between versions.
boolean
default:"true"
Once per page load, the SDK sends Revise one anonymous ping with its version. The browser adds your site’s origin. From localhost and other development hosts, only a daily count per version is kept, never the origin. The ping contains no cookies, user data, or document content. Set false to turn it off. See license. The ping is the SDK’s only report to Revise. It still downloads assets from https://revise.io when first needed (math fonts, PDF export fonts, the PDF import worker); setAssetBaseUrl() points it at your own mirror. An agent, if you configure one, talks only to the backend you chose.
(error: Error, documentId?: string) => void
Parse failures and runtime errors. A document that fails to open also shows status: "error" in the collection state.

Helpers

Promise<Blob>
Returns a blank DOCX. Use it for “New document” actions.