@mocanvas/editor · class
declare class TLEditorsRegistryThe registry behind tleditors. Exported for its type; the one
instance every editor registers with is tleditors.
Methods · 4
getMounted(): readonly Editor[]Every editor currently mounted, in the order they mounted.
// SEMANTICS-ASSUMED: mount order, and a fresh frozen array on every
change. Mount order is the only ordering available without asking the DOM,
and it makes getMounted()[0] mean "the first editor on the page", which
is what a single-editor app wants. A new array identity per change is what
lets useValue and computed compare by reference.
get mounted(): Signal<readonly Editor[]>The list as a signal, for code that wants to subscribe with react()
rather than read once. Reading .get() on it is the same as
TLEditorsRegistry.getMounted.
register(editor: Editor): () => voidAdd editor to the registry, returning the function that removes it
again. Registering an editor that is already registered changes nothing
and hands back a remover all the same, so a double-invoked effect (React
strict mode) cannot leave a duplicate behind.
unregister(editor: Editor): voidRemove editor. Removing one that is not registered is a no-op.
Mentioned here
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.