Opening
Documents come in as File, Blob, or ArrayBuffer, in any of the supported
formats. Supply them upfront with initialDocuments, or open
them at runtime:
open() resolves to a ReviseDocumentHandle once the document is parsed and
ready. Newly opened documents become active by default; pass
{ activate: false } to load one in the background.
IDs are yours and must be stable and unique within one editor instance.
Callbacks, tool routing, and forDocument() all key off them. Reusing an ID
for different content will confuse both your code and your agent.
Per-document options
Anything you can set editor-wide can be overridden per document:
Switching and closing
Closing is a workspace operation, not a save: export first if you need the
bytes.
Observing the collection
Each entry carries a status of "opening", "ready", or "error", plus an
error string when parsing failed — enough to render a tab strip with spinners
and error states without tracking it yourself.
Controlled or uncontrolled
By default the component tracks the active document internally. To drive it
from your own state, pass activeDocumentId and handle
onActiveDocumentChange:
defaultActiveDocumentId sets the initial choice without taking control.
Exporting
Reading content
For your own logic — word counts, validation, autosave heuristics — read the
document tree directly:
onChange(documentId, document) fires on every edit, from the user, your
toolbar, or an agent alike.
onChange is chatty by design — it fires per keystroke. Debounce before
persisting, and prefer measure_document or your own cheap heuristics over
walking the whole tree on every call.