Skip to content

Vizel API / core/src / VizelCreateEditorOptions

Interface: VizelCreateEditorOptions ​

Defined in: packages/core/src/types.ts:397

Options for creating a Vizel editor instance with framework hooks/composables/runes. Extends VizelEditorOptions with ability to add custom Tiptap extensions.

Extends ​

Properties ​

autofocus? ​

ts
optional autofocus?: number | boolean | "all" | "start" | "end";

Defined in: packages/core/src/types.ts:278

Auto focus on mount.

  • false (default) — do not focus.
  • true — focus and place the cursor at the end of the document.
  • "start" / "end" / "all" — focus with the corresponding selection.
  • number — focus and place the cursor at that document position (clamped to [0, docSize]).

Default ​

ts
false

Inherited from ​

VizelEditorOptions.autofocus


editable? ​

ts
optional editable?: boolean;

Defined in: packages/core/src/types.ts:268

Whether the editor accepts user input. Toggle at runtime to switch between read-write and read-only modes; the framework hooks/composables/runes propagate the change through editor.setEditable() automatically.

Default ​

ts
true

Inherited from ​

VizelEditorOptions.editable


extensions? ​

ts
optional extensions?: Extensions;

Defined in: packages/core/src/types.ts:412

Additional Tiptap extensions to include. These are added alongside the default Vizel extensions.

Example ​

typescript
import { useVizelEditor } from '@vizel/react';
import { Underline } from '@tiptap/extension-underline';

const editor = useVizelEditor({
  extensions: [Underline],
});

features? ​

ts
optional features?: VizelFeatureOptions;

Defined in: packages/core/src/types.ts:207

Feature configuration

Inherited from ​

VizelEditorOptions.features


initialContent? ​

ts
optional initialContent?: JSONContent;

Defined in: packages/core/src/types.ts:237

Initial content in JSON format.

Mutually exclusive with VizelEditorOptions.initialMarkdown. If both are provided, initialMarkdown wins and a warning is emitted at editor creation time.

Inherited from ​

VizelEditorOptions.initialContent


initialMarkdown? ​

ts
optional initialMarkdown?: string;

Defined in: packages/core/src/types.ts:252

Initial content in Markdown format.

Mutually exclusive with VizelEditorOptions.initialContent. If both are provided, initialMarkdown wins and a warning is emitted at editor creation time.

Example ​

typescript
const editor = useVizelEditor({
  initialMarkdown: "# Hello World\n\nThis is **bold** text.",
});

Inherited from ​

VizelEditorOptions.initialMarkdown


locale? ​

ts
optional locale?: VizelLocale;

Defined in: packages/core/src/types.ts:213

Locale for UI strings. Defaults to English (vizelEnLocale). Use createVizelLocale() to merge partial translations with the default.

Inherited from ​

VizelEditorOptions.locale


markdown? ​

ts
optional markdown?: object;

Defined in: packages/core/src/types.ts:226

Markdown pipeline configuration.

  • flavor selects the Markdown output flavor. The parser remains tolerant across formats; only serialization follows the selected flavor. Defaults to vizelGfmFlavor when omitted.
  • encoding selects the per-node encoding mode for nodes that have no canonical Markdown representation (embed, mention, wikiLink). "default" chooses the lossy-but-portable encoding; "metadata-comment" chooses the lossless-but-noisy encoding that preserves identifiers via a trailing HTML comment.

encoding? ​

ts
readonly optional encoding?: VizelMarkdownEncodingOptions;

flavor? ​

ts
readonly optional flavor?: VizelMarkdownFlavor;

Inherited from ​

VizelEditorOptions.markdown


onBlur? ​

ts
optional onBlur?: (props) => void;

Defined in: packages/core/src/types.ts:290

Callback when editor loses focus

Parameters ​

ParameterType
props{ editor: Editor; }
props.editorEditor

Returns ​

void

Inherited from ​

VizelEditorOptions.onBlur


onCreate? ​

ts
optional onCreate?: (props) => void;

Defined in: packages/core/src/types.ts:282

Callback when editor is created

Parameters ​

ParameterType
props{ editor: Editor; }
props.editorEditor

Returns ​

void

Inherited from ​

VizelEditorOptions.onCreate


onDestroy? ​

ts
optional onDestroy?: () => void;

Defined in: packages/core/src/types.ts:284

Callback when editor is destroyed

Returns ​

void

Inherited from ​

VizelEditorOptions.onDestroy


onError? ​

ts
optional onError?: (error) => void;

Defined in: packages/core/src/types.ts:324

Editor-level error sink. Receives a typed VizelError carrying a stable code so the consumer can log, branch, or render user feedback.

Two delivery paths reach this callback, matching the error model in .claude/rules/packages/core.md:

  • Configuration / initialization errors (INVALID_CONFIG, SSR_NOT_SUPPORTED, ...). The adapter emits the error to onErrorand then rethrows so global handlers (Sentry, window.onunhandledrejection, React error boundaries, test runners) still observe the failure. Supplying onError does not suppress the rethrow — a blank editor must never fail silently.
  • Recoverable runtime errors (UPLOAD_FAILED, EMBED_LOAD_FAILED, the MARKDOWN_LOSSY warning, ...). The core emits these through emitVizelError(error, onError) without rethrow; the editor keeps running. When no onError is set, the fallback writes errors to console.error and stays silent for warnings.

Image-upload failures route here in addition to the feature-level features.content.image.onUploadError, so observability sinks see the failure even when only the feature callback drives UI.

Parameters ​

ParameterType
errorVizelError

Returns ​

void

Example ​

typescript
const editor = useVizelEditor({
  onError: (error) => {
    reportToSentry(error);
    if (error.code === "UPLOAD_FAILED") showToast(error.message);
  },
});

Inherited from ​

VizelEditorOptions.onError


onFocus? ​

ts
optional onFocus?: (props) => void;

Defined in: packages/core/src/types.ts:288

Callback when editor gets focus

Parameters ​

ParameterType
props{ editor: Editor; }
props.editorEditor

Returns ​

void

Inherited from ​

VizelEditorOptions.onFocus


onSelectionUpdate? ​

ts
optional onSelectionUpdate?: (props) => void;

Defined in: packages/core/src/types.ts:286

Callback when selection changes

Parameters ​

ParameterType
props{ editor: Editor; }
props.editorEditor

Returns ​

void

Inherited from ​

VizelEditorOptions.onSelectionUpdate


onUpdate? ​

ts
optional onUpdate?: (props) => void;

Defined in: packages/core/src/types.ts:280

Callback when content changes

Parameters ​

ParameterType
props{ editor: Editor; }
props.editorEditor

Returns ​

void

Inherited from ​

VizelEditorOptions.onUpdate


placeholder? ​

ts
optional placeholder?: string;

Defined in: packages/core/src/types.ts:260

Placeholder text when editor is empty

Inherited from ​

VizelEditorOptions.placeholder


transformDiagramsOnImport? ​

ts
optional transformDiagramsOnImport?: boolean;

Defined in: packages/core/src/types.ts:258

Automatically transform diagram code blocks (mermaid, graphviz) to diagram nodes when importing markdown content. Only applies when initialMarkdown is provided.

Default ​

ts
true

Inherited from ​

VizelEditorOptions.transformDiagramsOnImport

Released under the MIT License.