Vizel API / core/src / createVizelEditorInstance
Function: createVizelEditorInstance()
ts
function createVizelEditorInstance(options): Promise<CreateVizelEditorInstanceResult>;Defined in: packages/core/src/utils/editorFactory.ts:118
Create a configured Vizel editor instance.
Intended for internal framework integrations. End users should prefer the framework primitives (useVizelEditor in @vizel/react/@vizel/vue, createVizelEditor in @vizel/svelte) which call this helper for them. The signature requires a createSlashMenuRenderer parameter that only framework packages can provide, and the function may change between minor releases.
Parameters
| Parameter | Type |
|---|---|
options | CreateVizelEditorInstanceOptions |
Returns
Promise<CreateVizelEditorInstanceResult>
Example
typescript
// In a framework hook/composable/rune:
const { editor, imageOptions } = createVizelEditorInstance({
initialMarkdown: "# Hello World",
features: { table: true },
createSlashMenuRenderer: () => createMySlashMenuRenderer(),
onUpdate: ({ editor }) => console.log(editor.getJSON()),
});