Skip to content

Vizel API / core/src / mountVizelEditorView

Function: mountVizelEditorView()

ts
function mountVizelEditorView(editor, container): () => void;

Defined in: packages/core/src/utils/editorHelpers.ts:28

Mount a Tiptap editor's view.dom into a container element and return a disposer that removes it.

Each framework's VizelEditor component previously hand-wrote the same three-step pattern:

  1. container.appendChild(editor.view.dom)
  2. editor.view.setProps({ editable: () => editor.isEditable })
  3. Cleanup that removes the DOM only if it is still parented to container (so swapping the editor or container does not yank a node that has already been re-parented elsewhere).

Lifting this into core keeps the three adapters as thin lifecycle wrappers and ensures behavior parity across React, Vue, and Svelte.

Parameters

ParameterType
editorEditor
containerHTMLElement

Returns

A disposer that detaches the editor view from the container.

() => void

Released under the MIT License.