@mermaid-editor-sdk/ui


@mermaid-editor-sdk/ui / MermaidVisualEditorOptions

Interface: MermaidVisualEditorOptions

Defined in: package/ui/src/runtime/types.ts:15

Initial value and event callbacks for the imperative visual editor.

Properties

onChange?

optional onChange?: (value) => void

Defined in: package/ui/src/runtime/types.ts:19

Called when the user edits the source; programmatic source updates do not invoke it.

Parameters

ParameterType
valuestring

Returns

void


onChangeDiagramType?

optional onChangeDiagramType?: (diagramType) => void

Defined in: package/ui/src/runtime/types.ts:21

Called after a new diagram type is selected and its default source is applied.

Parameters

ParameterType
diagramTypeEditableDiagramType

Returns

void


onError?

optional onError?: (error) => void

Defined in: package/ui/src/runtime/types.ts:25

Receives parse, render, mutation, save, or lifecycle errors.

Parameters

ParameterType
errorEditorError

Returns

void


onRemove?

optional onRemove?: (selection, nextSource) => void | Promise<void>

Defined in: package/ui/src/runtime/types.ts:31

Called after removal with the selection and resulting source.

Parameters

ParameterType
selectionEditorSelection
nextSourcestring

Returns

void | Promise<void>


onReset?

optional onReset?: (nextSource) => void | Promise<void>

Defined in: package/ui/src/runtime/types.ts:29

Called after Reset with the resulting source.

Parameters

ParameterType
nextSourcestring

Returns

void | Promise<void>


onSave?

optional onSave?: (currentSource) => void | Promise<void>

Defined in: package/ui/src/runtime/types.ts:27

Called by Save with the current source.

Parameters

ParameterType
currentSourcestring

Returns

void | Promise<void>


onSelectionChange?

optional onSelectionChange?: (selection) => void

Defined in: package/ui/src/runtime/types.ts:23

Called when the selection changes or clears.

Parameters

ParameterType
selectionEditorSelection | null

Returns

void


value

value: string

Defined in: package/ui/src/runtime/types.ts:17

Initial Mermaid source.