@yorkie-js/sdk
    Preparing search index...

    Class Tree

    Tree is a CRDT-based tree structure that is used to represent the document tree of text-based editor such as ProseMirror.

    Index

    Constructors

    Methods

    • buildRoot builds the root of this tree with the given initial root which set by the user.

      Parameters

      • context: ChangeContext

      Returns CRDTTreeNode

    • edit edits this tree with the given nodes.

      Parameters

      • fromIdx: number
      • toIdx: number
      • Optionalcontent: TreeNode
      • splitLevel: number = 0

      Returns boolean

    • editBulk edits this tree with the given nodes.

      Parameters

      • fromIdx: number
      • toIdx: number
      • contents: TreeNode[]
      • splitLevel: number = 0

      Returns boolean

    • editBulkByPath edits this tree with the given node and path.

      Parameters

      • fromPath: number[]
      • toPath: number[]
      • contents: TreeNode[]
      • splitLevel: number = 0

      Returns boolean

    • editByPath edits this tree with the given node and path.

      Parameters

      • fromPath: number[]
      • toPath: number[]
      • Optionalcontent: TreeNode
      • splitLevel: number = 0

      Returns boolean

    • getIndexTree returns the index tree of this tree.

      Returns IndexTree<CRDTTreeNode>

    • indexToPath returns the path of the given index.

      Parameters

      • index: number

      Returns number[]

    • initialize initialize this tree with context and internal tree.

      Parameters

      • context: ChangeContext
      • tree: CRDTTree

      Returns void

    • mergeByPath merges the tree by the given path.

      Parameters

      • path: number[]

      Returns void

    • pathToIndex returns the index of given path.

      Parameters

      • path: number[]

      Returns number

    • removeStyle removes the attributes to the elements of the given range.

      Parameters

      • fromIdx: number
      • toIdx: number
      • attributesToRemove: string[]

      Returns void

    • splitByPath splits the tree by the given path.

      Parameters

      • path: number[]

      Returns void

    • style sets the attributes to the elements of the given range.

      Parameters

      • fromIdx: number
      • toIdx: number
      • attributes: { [key: string]: any }

      Returns void

    • styleByPath sets the attributes to the elements of the given path.

      Parameters

      • path: number[]
      • attributes: { [key: string]: any }

      Returns void