@squareys/webdecks-sdk - v0.0.0
    Preparing search index...

    Class DocumentSelection

    The document's caret and selection. Positions are (paragraph, byteOffset) pairs. Reads reflect the current state; every mutator chains and repaints the attached viewport.

    Hierarchy (View Summary)

    Index
    • get caretParagraph(): number

      Paragraph index of the caret (the selection's moving end).

      Returns number

    • get caretByteOffset(): number

      Byte offset of the caret within its paragraph.

      Returns number

    • get anchorParagraph(): number

      Paragraph index of the anchor (the selection's fixed end).

      Returns number

    • get anchorByteOffset(): number

      Byte offset of the anchor within its paragraph.

      Returns number

    • get hasSelection(): boolean

      Whether a non-empty range is selected.

      Returns boolean

    • get isEmpty(): boolean

      Whether the selection is a collapsed caret (no range selected).

      Returns boolean

    • Copy the selection into the engine's clipboard.

      Returns this

    • Copy the selection into the clipboard, then delete it.

      Returns this

    • Insert the clipboard contents at the caret, replacing any selection.

      Returns this

    • Collapse the selection to the caret.

      Returns this

    • Place a collapsed caret at (paragraph, byteOffset).

      Parameters

      • paragraph: number
      • byteOffset: number

      Returns this

    • Select the byte range [start, end) within one paragraph.

      Parameters

      • paragraph: number
      • start: number
      • end: number

      Returns this

    • Move the caret by unit in direction; extend grows the selection instead of collapsing it. Line-based units need a laid-out document (a live viewport).

      Parameters

      • unit: number
      • direction: number
      • extend: boolean = false

      Returns this

    • Move one character left.

      Parameters

      • extend: boolean = false

      Returns this

    • Move one character right.

      Parameters

      • extend: boolean = false

      Returns this

    • Move one word left.

      Parameters

      • extend: boolean = false

      Returns this

    • Move one word right.

      Parameters

      • extend: boolean = false

      Returns this

    • Move up one line (needs a laid-out document).

      Parameters

      • extend: boolean = false

      Returns this

    • Move down one line (needs a laid-out document).

      Parameters

      • extend: boolean = false

      Returns this

    • Move to the start of the line (needs a laid-out document).

      Parameters

      • extend: boolean = false

      Returns this

    • Move to the end of the line (needs a laid-out document).

      Parameters

      • extend: boolean = false

      Returns this

    • Move to the start of the document.

      Parameters

      • extend: boolean = false

      Returns this

    • Move to the end of the document.

      Parameters

      • extend: boolean = false

      Returns this