Trilium Frontend API
    Preparing search index...

    Interface MouseSelectionStyle

    Interface that objects registered with EditorView.mouseSelectionStyle must conform to.

    interface MouseSelectionStyle {
        get: (
            curEvent: MouseEvent,
            extend: boolean,
            multiple: boolean,
        ) => EditorSelection;
        update: (update: ViewUpdate) => boolean | void;
    }
    Index

    Properties

    Properties

    get: (
        curEvent: MouseEvent,
        extend: boolean,
        multiple: boolean,
    ) => EditorSelection

    Return a new selection for the mouse gesture that starts with the event that was originally given to the constructor, and ends with the event passed here. In case of a plain click, those may both be the mousedown event, in case of a drag gesture, the latest mousemove event will be passed.

    When extend is true, that means the new selection should, if possible, extend the start selection. If multiple is true, the new selection should be added to the original selection.

    update: (update: ViewUpdate) => boolean | void

    Called when the view is updated while the gesture is in progress. When the document changes, it may be necessary to map some data (like the original selection or start position) through the changes.

    This may return true to indicate that the get method should get queried again after the update, because something in the update could change its result. Be wary of infinite loops when using this (where get returns a new selection, which will trigger update, which schedules another get in response).