• Returns a cursor for the given position in a string.

    Remarks

    A cursor represents a relative position, "before character X", rather than an absolute position. As the document is edited, the cursor remains stable relative to its context, just as you'd expect from a cursor in a concurrent text editor.

    The string representation is shareable, and so you can use this both to edit the document yourself (using splice) or to share multiple collaborator's current cursor positions over the network.

    Type Parameters

    • T

      The type of the value contained in the document

    Parameters

    • doc: Doc<T>

      The document

    • path: Prop[]

      The path to the string

    • index: number

      The current index of the position of the cursor

    Returns Cursor

Generated using TypeDoc