BlockSuite API Documentation / @blocksuite/affine-block-surface / MindmapUtils
Variable: MindmapUtils
constMindmapUtils:object
Type declaration
addTree()
addTree: (
mindmap,parent,tree,sibling?) =>undefined|null|MindmapNode
Parameters
• mindmap: MindmapElementModel
• parent: string | MindmapNode
• tree: MindmapNode | Node
• sibling?: string | number
sibling indicates where to insert a subtree among peer elements. If it's a string, it represents a peer element's ID; if it's a number, it represents its index. The subtree will be inserted before the sibling element.
Returns
undefined | null | MindmapNode
createFromTree()
createFromTree: (
tree,style,layoutType,surface) =>MindmapElementModel
Parameters
• tree: MindmapNode
• style: MindmapStyle
• layoutType: LayoutType
• surface: SurfaceBlockModel
Returns
detachMindmap()
detachMindmap: (
mindmap,subtree) =>undefined|MindmapNode
Detach a mindmap. It is similar to removeChild but it does not delete the node.
So the node can be used to create a new mind map or merge into other mind map
Parameters
• mindmap: MindmapElementModel
• subtree: string | MindmapNode
Returns
undefined | MindmapNode
handleLayout()
handleLayout: (
mindmap,tree?,shouldApplyStyle,layoutType?) =>void
Parameters
• mindmap: MindmapElementModel
• tree?: MindmapNode | MindmapRoot
• shouldApplyStyle?: boolean = true
• layoutType?: LayoutType
Returns
void
hideTargetConnector()
hideTargetConnector: (
mindmap,target) =>undefined| () =>void
Hide the connector that the target end point is given node
Parameters
• mindmap: MindmapElementModel
• target: MindmapNode
The mind map node which's connector will be hide
Returns
undefined | () => void
moveMindMapSubtree()
moveMindMapSubtree: (
from,subtree,to,parent,index,layout?) =>undefined|null|MindmapNode
Move a subtree from one mind map to another
Parameters
• from: MindmapElementModel
• subtree: MindmapNode
• to: MindmapElementModel
• parent: string | MindmapNode
• index: number
• layout?: LayoutType
Returns
undefined | null | MindmapNode
showMergeIndicator()
showMergeIndicator: (
targetMindmap,target,source,position) =>undefined|object
Show merge indicator when tree is hovered on a tree
Parameters
• targetMindmap: MindmapElementModel
• target: string | MindmapNode
The hovered node
• source: MindmapNode
The node that will be merged
• position: [number, number]
Returns
undefined | object
Defined in
packages/affine/block-surface/src/index.ts:143