Skip to main content
Implement this protocol to add editor support for a custom binary file format. Files with a claimed extension import as blobs, keeping their raw bytes, and get previews from view. For text formats that should be editable in the editor, implement TextFileFormat instead.

Fields

name

Display name of the format, e.g. “Markdown”.

extensions

File extensions handled, without dots, e.g. {"md", "markdown"}.

Methods

parse

Optional. Called once per document version; the returned buffer is cached by Rive, keyed to the document’s content, and passed back into every other callback. Within one VM the same buffer object is reused; across VMs the bytes are copied once.

view

Creates the preview for a document on a surface. Each surface gets its own view; a document can be visible on several at once.