Production deployment
Zero-egress configuration, printing, accessibility, Node scaling, and non-React hosts.
Zero-egress checklist#
To run the SDK with zero outbound requests to Revise servers:
- Disable telemetry: pass
telemetry={false}on<ReviseEditor />. - Self-host static assets: mirror
fonts/,wasm/(refresh on every SDK release—filenames are content-hashed),katex.min.css,pdfjs/, andtree-sitter/(revise/fullonly) fromhttps://revise.ioto your own origin, then callsetAssetBaseUrl("https://assets.example.com/revise")once at startup. - Delegated agent: omit
agent(or pointagent.baseUrl/agent.turnStreamat your own backend, and setdisableMetrics: trueif using a custombaseUrl). - Server image fetching (
revise/server): configureOpenOptions.images(ImageFetchPolicy) if you want a customfetchproxy or stricter size/host rules (by default, private/loopback/link-local IPs are blocked and downloads are capped at 20 MB). - Server PDF WASM (
revise/server): place the krilla.wasmfiles inpublic/wasm/under the Node process working directory sodoc.export({ format: "pdf" })loads them locally instead of fetching ~2.2 MB fromhttps://revise.ioon first export.
Commercial license keys (licenseKey) are verified offline and never sent over the network.
Printing#
Because pages render to <canvas>, native window.print() does not paginate document content. Print by exporting a PDF and handing it to the browser's PDF printer:
TypeScript
async function printDocument(editor: ReviseEditorHandle) {
const blob = await editor.tools.export({ format: "pdf", mode: "final" });
const url = URL.createObjectURL(blob);
const frame = document.createElement("iframe");
frame.style.display = "none";
frame.src = url;
document.body.appendChild(frame);
frame.onload = () => {
frame.contentWindow?.focus();
frame.contentWindow?.print();
setTimeout(() => {
URL.revokeObjectURL(url);
frame.remove();
}, 60_000);
};
}Accessibility#
- Supported: Full keyboard editing and navigation, standard DOM controls for the ribbon/dialogs/panels, screen-reader progress announcements during PDF export, and accessible tagged PDF output (
pdfStandard: "pdf-ua-1"viarevise/server). - Limitation: Document body text is painted to
<canvas>and is not exposed in the DOM for screen readers. If WCAG screen-reader access to body text is required, pair the editor with an HTML/Markdown read view (tools.export({ format: "html" })) or tagged PDF export.
Performance and scaling#
Browser#
- Lazy-load
<ReviseEditor />and"revise/style.css"on the document route (load on demand). - For high-volume agent edits, offload edit staging to the bundled Web Worker via
agent.stagingWorker:
TypeScript
<ReviseEditor
agent={{
stagingWorker: () =>
new Worker(new URL("revise/staging-worker", import.meta.url), {
type: "module",
}),
}}
/>Vite requires worker: { format: "es" } so the worker shares ES module chunks.
- For faster word diffs and document stats, opt into
wasmHotPathsviarevise/full(not CSP-safe).
Node (revise/server)#
- Dispose every instance: always wrap
ReviseDocumentusage intry { ... } finally { doc.dispose(); }to release Yjs andjsdommemory. - Concurrency: operations on a single
ReviseDocumentserialize automatically. For batch document processing or PDF generation across many files, run a bounded concurrency pool or Nodeworker_threadsrather than opening unbounded documents simultaneously. - PDF engine in Node: install
@napi-rs/canvas(recommended) orcanvassodoc.export({ format: "pdf" })anddoc.renderPages()use the krilla/canvas pipeline. Without a canvas package (or if the WASM writer cannot load),export({ format: "pdf" })falls back to the legacy writer andpdfStandardexports fail.
Non-React hosts (Vue, Angular, vanilla)#
revise is a React 18+ component. To embed it in a non-React application, mount it inside a thin react-dom/client wrapper and expose ReviseEditorHandle:
mountRevise.ts
import React from "react";
import { createRoot } from "react-dom/client";
import ReviseEditor, {
type ReviseEditorHandle,
type ReviseEditorProps,
} from "revise";
import "revise/style.css";
export function mountReviseEditor(
container: HTMLElement,
props: ReviseEditorProps,
): { ready: Promise<ReviseEditorHandle>; unmount: () => void } {
const root = createRoot(container);
let resolveReady!: (handle: ReviseEditorHandle) => void;
const ready = new Promise<ReviseEditorHandle>((r) => (resolveReady = r));
root.render(
React.createElement(ReviseEditor, {
...props,
onReady: (handle) => {
resolveReady(handle);
props.onReady?.(handle);
},
}),
);
return { ready, unmount: () => root.unmount() };
}