Trilium Frontend API
    Preparing search index...

    Class EditingKeystrokeHandler

    A keystroke handler for editor editing. Its instance is available in module:core/editor/editor~Editor#keystrokes so plugins can register their keystrokes.

    E.g. an undo plugin would do this:

    editor.keystrokes.set( 'Ctrl+Z', 'undo' );
    editor.keystrokes.set( 'Ctrl+Shift+Z', 'redo' );
    editor.keystrokes.set( 'Ctrl+Y', 'redo' );

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    editor: Editor

    The editor instance.

    Methods

    • Destroys the keystroke handler.

      Returns void

    • Triggers a keystroke handler for a specified key combination, if such a keystroke was #set defined.

      Parameters

      Returns boolean

      Whether the keystroke was handled.

    • Registers a handler for the specified keystroke.

      The handler can be specified as a command name or a callback.

      Parameters

      • keystroke: string | (string | number)[]

        Keystroke defined in a format accepted by the module:utils/keyboard~parseKeystroke function.

      • callback: EditingKeystrokeCallback

        If a string is passed, then the keystroke will module:core/editor/editor~Editor#execute execute a command. If a function, then it will be called with the module:engine/view/observer/keyobserver~ViewDocumentKeyEventData key event data object and a cancel() helper to both preventDefault() and stopPropagation() of the event.

      • Optionaloptions: { priority?: PriorityString }

        Additional options.

        • Optional Readonlypriority?: PriorityString

          The priority of the keystroke callback. The higher the priority value the sooner the callback will be executed. Keystrokes having the same priority are called in the order they were added.

      Returns void