@mocanvas/editor · interface
interface EditorOptionsThis one ships without a description. The signature above is read from the package, and the guides cover the area it belongs to.
Properties · 19
assets?: AssetStoreWhere asset bytes live. Defaults to the store's own
(store.props.assets), which is where an app that built its store with
createStore({ assets }) already put it — pass this only to give one
editor a different store than its document has.
assetUtils?: readonly TLAssetUtilConstructorLike[]Asset utils to register. See Editor.assetUtils.
bindingUtils?: readonly BindingUtilConstructor[]colorScheme?: TLColorSchemeLight, dark, or follow the host window. Defaults to "light".
engine?: EngineBridgeThe WebAssembly engine. Optional: when omitted, the engine registered
through registerEngineProvider is used — mocanvas registers one
that returns whatever loadEngine() last produced. Pass it explicitly to
run two editors on separate engines.
getContainer?: () => HTMLElementThe element the editor lives in. Optional, and optional is the point: an
editor with no screen — an agent on a server, a fold job, a test — has no
element to give, and requiring one made the headless path start by
inventing a fake DOM node. Everything inside already copes (see
safeContainer); it was only the type that insisted.
Omitted, Editor.getContainer throws if anything asks for it, which is a sentence rather than a mystery further down.
getInitialMetaForShape?: (shape: UnknownShape) => UnknownShape["meta"]The meta every newly created shape starts with — the seam an app uses to
stamp provenance (author, campaign, template) onto shapes without
intercepting every creation site.
getShapeVisibility?: TLGetShapeVisibilityThe host's hook for hiding shapes without deleting them — layers, filters, a review mode. Consulted per shape in the render path, so it must be cheap and pure. See TLGetShapeVisibility.
initialState?: stringId of the tool to start in. Defaults to the first tool.
initialTheme?: TLThemeIdWhich theme starts out current. Defaults to "default".
options?: Partial<EditorConfig>overlayUtils?: readonly TLAnyOverlayUtilConstructor[]Canvas overlay painters to register with Editor.overlays.
shapeUtils: readonly ShapeUtilConstructor[]store: EditorStoretextOptions?: TLTextOptionsRich-text configuration. Also readable as options.text; this top-level
spelling is the one the consumer passes, and the two are the same object
— Editor.textOptions resolves whichever was given.
themes?: TLThemesInputThemes to register, merged over the built-in default.
tools: readonly StateNodeConstructor[]user?: CurrentUserWho is using this editor, as the owner of their preferences — the *controlled* form: an app that holds the preferences in its own state passes them in and gets every write back, instead of the editor keeping a copy the app cannot see. Defaults to an editor-owned atom.
userStore?: UserStoreWhere the editor asks about people, for attribution. Optional: with no
store, getAttributionUser answers null and display names fall back to
the id, which is exactly what a single-player board wants.
mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.