Options
All
  • Public
  • Public/Protected
  • All
Menu

Defines a floating pointer in the document. Whenever text is inserted or deleted before the cursor, the position of the anchor is updated.

Hierarchy

  • Anchor

Implements

Index

Constructors

constructor

  • Creates a new Anchor and associates it with a document.

    Parameters

    • doc: Document

      The document to associate with the anchor

    • row: Number

      The starting row position

    • column: Number

      The starting column position

    Returns Anchor

Events

on

  • on(name: "change", callback: (e: Object) => void): void
  • on(name: string, callback: Function, capturing?: boolean): void
  • Fires whenever the anchor position changes.

    Both of these objects have a row and column property corresponding to the position.

    Events that can trigger this function include setPosition().

    Parameters

    • name: "change"
    • callback: (e: Object) => void
        • (e: Object): void
        • Parameters

          • e: Object

          Returns void

    Returns void

  • Parameters

    • name: string
    • callback: Function
    • Optional capturing: boolean

    Returns void

Methods

attach

  • When called, the "change" event listener is appended.

    Parameters

    • doc: Document

      The document to associate with

    Returns void

detach

  • detach(): void
  • When called, the "change" event listener is removed.

    Returns void

getDocument

getPosition

  • Returns an object identifying the row and column position of the current anchor.

    Returns Position

onChange

  • onChange(delta: Delta): void
  • Internal function called when "change" event fired.

    Parameters

    Returns void

setPosition

  • setPosition(row: number, column: number, noClip?: boolean): void
  • Sets the anchor position to the specified row and column. If noClip is true, the position is not clipped.

    Parameters

    • row: number

      The row index to move the anchor to

    • column: number

      The column index to move the anchor to

    • Optional noClip: boolean

      Identifies if you want the position to be clipped

    Returns void

Generated using TypeDoc