Class Text<A>

Text is an extended data type for the contents of a text editor.

Type Parameters

Constructors

Properties

context?: ChangeContext<Indexable>
text?: CRDTText<A>

Accessors

Methods

  • createRangeForTest returns pair of RGATreeSplitNodePos of the given indexes for testing purpose.

    Parameters

    • fromIdx: number
    • toIdx: number

    Returns RGATreeSplitPosRange

  • delete deletes the text in the given range.

    Parameters

    • fromIdx: number
    • toIdx: number

    Returns undefined | [number, number]

  • edit edits this text with the given content.

    Parameters

    • fromIdx: number
    • toIdx: number
    • content: string
    • Optional attributes: A

    Returns undefined | [number, number]

  • empty makes the text empty.

    Returns undefined | [number, number]

  • getTreeByID returns IDTree of the text for testing purpose.

    Returns LLRBTree<RGATreeSplitNodeID, RGATreeSplitNode<CRDTTextValue>>

  • getTreeByIndex returns IndexTree of the text for testing purpose.

    Returns SplayTree<CRDTTextValue>

  • Internal

    initialize initialize this text with context and internal text.

    Parameters

    • context: ChangeContext<Indexable>
    • text: CRDTText<A>

    Returns void

  • setStyle styles this text with the given attributes.

    Parameters

    • fromIdx: number
    • toIdx: number
    • attributes: A

    Returns boolean

  • toString returns the string representation of this text.

    Returns string

  • toTestString returns a String containing the meta data of the node for debugging purpose.

    Returns string