Trilium Frontend API
    Preparing search index...

    Interface EditorViewConfig

    The type of object given to the EditorView constructor.

    interface EditorViewConfig {
        dispatch?: (tr: Transaction, view: EditorView) => void;
        dispatchTransactions?: (
            trs: readonly Transaction[],
            view: EditorView,
        ) => void;
        doc?: string | Text;
        extensions?: Extension;
        parent?: Element | DocumentFragment;
        root?: Document | ShadowRoot;
        scrollTo?: StateEffect<any>;
        selection?: EditorSelection | { anchor: number; head?: number };
        state?: EditorState;
    }

    Hierarchy (View Summary)

    Index

    Properties

    dispatch?: (tr: Transaction, view: EditorView) => void

    Deprecated* single-transaction version of dispatchTransactions. Will force transactions to be dispatched one at a time when used.

    dispatchTransactions?: (trs: readonly Transaction[], view: EditorView) => void

    Override the way transactions are dispatched for this editor view. Your implementation, if provided, should probably call the view's update method.

    doc?: string | Text

    The initial document. Defaults to an empty document. Can be provided either as a plain string (which will be split into lines according to the value of the lineSeparator facet), or an instance of the Text class (which is what the state will use to represent the document).

    extensions?: Extension

    Extension(s) to associate with this state.

    parent?: Element | DocumentFragment

    When given, the editor is immediately appended to the given element on creation. (Otherwise, you'll have to place the view's dom element in the document yourself.)

    root?: Document | ShadowRoot

    If the view is going to be mounted in a shadow root or document other than the one held by the global variable document (the default), you should pass it here. If you provide parent, but not this option, the editor will automatically look up a root from the parent.

    scrollTo?: StateEffect<any>

    Pass an effect created with EditorView.scrollIntoView or EditorView.scrollSnapshot here to set an initial scroll position.

    selection?: EditorSelection | { anchor: number; head?: number }

    The starting selection. Defaults to a cursor at the very start of the document.

    state?: EditorState

    The view's initial state. If not given, a new state is created by passing this configuration object to EditorState.create, using its doc, selection, and extensions field (if provided).