Trilium Frontend API
    Preparing search index...

    Class SelectionRange

    A single selection range. When allowMultipleSelections is enabled, a selection may hold multiple ranges. By default, selections hold exactly one range.

    Index

    Properties

    from: number

    The lower boundary of the range.

    to: number

    The upper boundary of the range.

    Accessors

    • get anchor(): number

      The anchor of the range—the side that doesn't move when you extend it.

      Returns number

    • get assoc(): -1 | 0 | 1

      If this is a cursor that is explicitly associated with the character on one of its sides, this returns the side. -1 means the character before its position, 1 the character after, and 0 means no association.

      Returns -1 | 0 | 1

    • get bidiLevel(): number

      The bidirectional text level associated with this cursor, if any.

      Returns number

    • get empty(): boolean

      True when anchor and head are at the same position.

      Returns boolean

    • get goalColumn(): number

      The goal column (stored vertical offset) associated with a cursor. This is used to preserve the vertical position when moving across lines of different length.

      Returns number

    • get head(): number

      The head of the range, which is moved when the range is extended.

      Returns number

    Methods

    • Compare this range to another range.

      Parameters

      Returns boolean

    • Extend this range to cover at least from to to.

      Parameters

      • from: number
      • Optionalto: number
      • Optionalassoc: number

      Returns SelectionRange

    • Map this range through a change, producing a valid range in the updated document.

      Parameters

      Returns SelectionRange

    • Return a JSON-serializable object representing the range.

      Returns any

    • Convert a JSON representation of a range to a SelectionRange instance.

      Parameters

      • json: any

      Returns SelectionRange