Revise Editor SDK menu

Chrome and toolbars

Configure built-in chrome or replace it with custom UI via the handle.

All built-in chrome around the canvas is optional and backed by handle controllers.

Optional chrome#

ElementPropDefaultController
Tab stripshowTabsfalsedocuments
Title barshowTitleBartrueview
RibbontoolbarMode"native"toolbar
Editing/Suggesting toggleshowDocumentModeTogglefalseview.setDocumentMode()
Comments panel——view.setCommentsOpen()

There is no built-in comments toggle button; comment chips render in the margin, and your UI toggles the panel.

Ribbon modes#

toolbarModeRendering
"native"Full ribbon.
"compact"Centered subset for narrow hosts (~760px): undo/redo, font, size, styles, paragraph, links, indents, lists, Find, Export.
"floating"Full ribbon as a centered card over the canvas.
"none"No built-in toolbar.

Custom toolbar#

Pass toolbarMode="none", subscribe to handle.toolbar, and call commands from your controls:

TSX
const [state, setState] = useState<ReviseToolbarState | null>(null);
const editor = useRef<ReviseEditorHandle | null>(null);

<ReviseEditor
  initialDocuments={docs}
  toolbarMode="none"
  showTitleBar={false}
  onReady={(handle) => {
    editor.current = handle;
    handle.toolbar.subscribe(setState);
  }}
/>;

<button
  aria-pressed={state?.formatting.bold ?? false}
  disabled={!state?.ready}
  onClick={() => editor.current?.toolbar.toggleBold()}
>
  Bold
</button>;

ReviseToolbarState exposes ready, readOnly, documentMode, hasSelection, canUndo/canRedo, formatting, heading, alignment, lineSpacing, fontSizePt, blockType, and review.

Store the unsubscribe function returned by subscribe() and call it on unmount. State updates on every selection change.

Toolbar commands#

Commands return false when inapplicable (read-only document, empty undo stack, etc.).

Clipboard and history

undo, redo, copy, copyAs("plaintext" | "markdown" | "html"), cut, paste, pasteTextOnly, pasteFormattingOnly

Inline formatting

toggleInline, toggleBold, toggleItalic, toggleUnderline, toggleStrikethrough, toggleDoubleStrikethrough, toggleSmallCaps, toggleAllCaps, toggleCode, toggleLatex, toggleSuperscript, toggleSubscript, clearFormatting, setFontFamily, setFontSize, setLetterSpacing, setTextColor, setHighlightColor

Paragraph and block

setHeading, setAlignment, setLineSpacing, toggleList, createLink, increaseIndent, decreaseIndent

Insertion

insertTable, insertImage, insertContainer, insertCodeBlock, insertMathBlock, insertDiagram, insertFootnote, insertPageNumber, insertPageBreak, insertSectionBreak

Review

openReview, closeReview, reviewPrevious, reviewNext, acceptCurrent, rejectCurrent, acceptAll, rejectAll, setShowRemovals, setSuggestionViewMode

View controller#

editor.view manages title, document mode, and panels:

TypeScript
const { title, documentMode, commentsOpen, reviewOpen, reviewTargetCount } =
  editor.view.getState();

editor.view.setTitle("Master Services Agreement");
editor.view.setDocumentMode("suggesting");
editor.view.setReviewOpen(true);
editor.view.setCommentsOpen(true);

Narrow hosts#

Because Revise renders paginated pages, narrow viewports trade off whole-page scale vs. horizontal panning. Measured in Chromium (toolbarMode="compact", US Letter):

Host widthFit width (default)With comments panel openAt zoom.setZoom(1)
390px350px (43%)150px (18%)816px, pans horizontally
420px380px (47%)180px (22%)816px, pans horizontally
768px728px (89%)405px (50%)816px, pans horizontally

Recommendations below ~600px:

  • Keep the built-in comments panel closed (it reserves ≥200px beside the page). Render threads in your own drawer via review.getState().commentThreads / review.subscribe() and jump to anchors with review.selectComment(thread.root.id, { openPanel: false }).
  • Expose a reading zoom: zoom.setZoom(1) or 1.25 enables horizontal scrolling at readable text size; zoom.fitWidth() restores whole-page fit.
  • Toolbar: use toolbarMode="compact" around 760px and "none" with custom controls on phone widths (compact does not wrap and clips trailing buttons).
  • Stacking: the editor creates its own stacking context, so inline comment cards never overlap external host UI. Open dialogs and menus render in a top-level portal above host content.

Touch gestures (pinch zoom, long-press selection), virtual keyboards, and screen readers are not covered by these measurements.

Built-in tabs#

Enable tabs with showTabs. The + button renders only when onNewTab is provided:

TSX
<ReviseEditor
  showTabs
  onNewTab={() => openBlankDocument()}
  initialDocuments={docs}
/>

Focus#

The editor takes keyboard focus when a document activates. Pass autoFocus={false} to focus only on click:

TSX
<ReviseEditor autoFocus={false} initialDocuments={docs} />