Trevixal API
    Preparing search index...

    Class Editor

    The headless editor: owns the state, dispatches transactions, records history and exposes commands. A DOM view attaches to it when an element is supplied.

    Index
    commands: EditorCommands
    view: EditorView | null = null

    The attached DOM view, when an element was supplied.

    • get canRedo(): boolean

      Returns boolean

    • get canUndo(): boolean

      Returns boolean

    • get isDestroyed(): boolean

      Returns boolean

    • get isEditable(): boolean

      Returns boolean

    • get schema(): Schema

      Returns Schema

    • Register a transform that can rewrite transactions before they apply.

      Parameters

      Returns () => void

    • Start a chained command sequence: editor.chain().focus().setHeading(2).run().

      Returns Chain

    • Forget every undo and redo group.

      Returns void

    • Returns void

    • Parameters

      Returns void

    • Run a command against the current state; dispatches when it applies.

      Parameters

      Returns boolean

    • Returns number

    • Returns string

    • Returns NodeJSON

    • Returns number

    • Returns number

    • Toolbar-facing snapshot.

      Reference-stable while its contents are unchanged, not merely between transactions, so typing a character returns the very same object, and a toolbar subscribed through useSyncExternalStore, a signal or a store does not re-render on every keystroke. It changes identity when something a toolbar would actually draw differently changes: a mark, the block type, whether undo is available.

      Subscribers are still notified per transaction; what this decides is whether they have anything new to look at.

      Returns EditorSnapshot

    • Returns string

    • Returns number

    • The undo and redo stacks as a history panel lists them.

      Returns { redo: readonly HistoryEntry[]; undo: readonly HistoryEntry[] }

    • Parameters

      • markName: string

      Returns boolean

    • Parameters

      Returns () => void

    • Listen to applied transactions with their before/after states.

      Parameters

      Returns () => void

    • Returns boolean

    • Replace the whole document: loading a saved file, switching documents, restoring a draft. That is not an edit of the current text, so by default the change stays out of the undo history and the history is cleared; pass addToHistory: true to make the replacement undoable instead.

      Parameters

      Returns void

    • Toggle read-only mode on the attached view.

      Parameters

      • editable: boolean

      Returns void

    • Turn the browser's spell checking of the editing surface on or off.

      Parameters

      • enabled: boolean

      Returns void

    • Subscribe to state changes (the contract external stores expect).

      Parameters

      • listener: () => void

      Returns () => void

    • Returns boolean