@mocanvas/editor · class
declare class ContentElementManagerOne element per shape, for as long as the shape exists.
A shape's content element is created the first time it is asked for and is
then *the same node* for the life of the shape: mounting it somewhere else
moves it, which is what lets an iframe keep its session across a re-render,
a scroll out of view, or an unmount and remount of the whole editor UI. It
is torn down only when the shape is deleted or the editor is disposed —
both of which route through release.
A util that does not implement getContentElement never appears here at all.
Methods · 5
constructor(host: ContentElementHost)dispose(): voidRelease everything. Called when the editor is disposed.
get(shape: UnknownShape): HTMLElement | undefinedThis shape's content element, creating it on first use. undefined when
the shape's util does not have one to give — the common case.
has(id: ShapeId): booleanWhether this shape currently holds an element.
release(id: ShapeId): voidGive up this shape's element: detach it from wherever it is mounted and tell the util it is gone. A no-op for a shape that never had one.
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.