Skip to content

EmbeddableMarkdownEditorComponentConstructorParams

The parameters of the EmbeddableMarkdownEditorComponent constructor.

Import:

import type { EmbeddableMarkdownEditorComponentConstructorParams } from '@mnaoumov/obsidian-lib/components/embeddable-markdown-editor-component';

Signature:

export interface EmbeddableMarkdownEditorComponentConstructorParams

Properties

PropertyTypeDescription
appAppThe Obsidian app instance.
cls?stringA CSS class added to the editor element.
containerElHTMLElementThe element the editor is mounted in. The editor appends its own element to it and removes only that element when it unloads.
cursorLocation?EmbeddableMarkdownEditorComponentSelectionThe initial selection, as document offsets. The cursor starts at the beginning of the document otherwise.
onBlur?(component: EmbeddableMarkdownEditorComponent) => voidCalled when the editor loses focus, while the component is still loaded.
onChange?(update: ViewUpdate, component: EmbeddableMarkdownEditorComponent) => voidCalled after every change to the document.
onEnter?(params: EmbeddableMarkdownEditorComponentEnterParams) => booleanCalled on Enter, Shift+Enter, Mod+Enter and Mod+Shift+Enter.

When given, Mod+Enter no longer runs the Obsidian hotkey bound to it (by default, opening the link under the cursor in a new tab) while the editor has the focus, so a form can use it to submit.
onEscape?(component: EmbeddableMarkdownEditorComponent) => voidCalled on Escape. When given, the key goes no further.
onPaste?($event: ClipboardEvent, component: EmbeddableMarkdownEditorComponent) => voidCalled on a paste into the editor, before the editor handles it.
placeholder?stringThe text shown while the document is empty.
value?stringThe initial document.