Constructors
constructor
- new Tree(initialRoot?): Tree
Properties
Private
Optional
initialRoot
Private
Optional
tree
tree?: CRDTTree
Methods
buildRoot
- buildRoot(context): CRDTTreeNode
Returns CRDTTreeNode
edit
- edit(fromIdx, toIdx, content?, splitLevel?): boolean
Parameters
- fromIdx: number
- toIdx: number
Optional
content: TreeNode- splitLevel: number = 0
Returns boolean
editBulk
- editBulk(fromIdx, toIdx, contents, splitLevel?): boolean
Parameters
- fromIdx: number
- toIdx: number
- contents: TreeNode[]
- splitLevel: number = 0
Returns boolean
editBulkByPath
- editBulkByPath(fromPath, toPath, contents, splitLevel?): boolean
Parameters
- fromPath: number[]
- toPath: number[]
- contents: TreeNode[]
- splitLevel: number = 0
Returns boolean
editByPath
- editByPath(fromPath, toPath, content?, splitLevel?): boolean
Parameters
- fromPath: number[]
- toPath: number[]
Optional
content: TreeNode- splitLevel: number = 0
Returns boolean
Private
editInternal
- editInternal(fromPos, toPos, contents, splitLevel?): boolean
Parameters
- fromPos: CRDTTreePos
- toPos: CRDTTreePos
- contents: TreeNode[]
- splitLevel: number = 0
Returns boolean
getIndexTree
- getIndexTree(): IndexTree<CRDTTreeNode>
Returns IndexTree<CRDTTreeNode>
getNodeSize
- getNodeSize(): number
Returns number
getSize
- getSize(): number
Returns number
indexToPath
- indexToPath(index): number[]
Returns number[]
initialize
- initialize(context, tree): void
Internal
Parameters
- context: ChangeContext<Indexable>
- tree: CRDTTree
Returns void
pathToIndex
- pathToIndex(path): number
Returns number
posRangeToIndexRange
- posRangeToIndexRange(range): [number, number]
Returns [number, number]
posRangeToPathRange
- posRangeToPathRange(range): [number[], number[]]
Returns [number[], number[]]
removeStyle
- removeStyle(fromIdx, toIdx, attributesToRemove): void
Parameters
- fromIdx: number
- toIdx: number
- attributesToRemove: string[]
Returns void
style
- style(fromIdx, toIdx, attributes): void
Parameters
- fromIdx: number
- toIdx: number
- attributes: {
[key: string]: any;
}
Returns void
styleByPath
- styleByPath(path, attributes): void
Parameters
- path: number[]
- attributes: {
[key: string]: any;
}
Returns void
toJSON
- toJSON(): string
Returns string
toXML
- toXML(): string
Returns string
Tree
is a CRDT-based tree structure that is used to represent the document tree of text-based editor such as ProseMirror.