FBoardMindMapNode
Facade for one structured mind map node.
Node facades are obtained from a map's root, node lookup, or node list. They expose semantic text and structure operations without requiring an agent to retain generated element ids.
Access
Access through:
FBoardMindMap.getRootNode()FBoardMindMap.getNodes()FBoardMindMap.getNode()FBoardMindMap.getDescendants()
Setup
Register @univerjs-pro/boards-mind or a preset that includes it. In plugin mode, import @univerjs-pro/boards-mind/facade. Additional methods below require their listed plugin packages. See Facade setup.
@univerjs-pro/boards-mind
FBoardMindMapNode.addChild
Adds a child and persists its node and connector ids with the initial structural mutation.
addChild(options: IBoardMindMapFacadeAddChildOptions): FBoardMindMapNode | nullParameters
options— Required. Child text, generated ids, and optional side.
Returns
New child facade, or null when the operation fails.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const root = board.insertMindMap({ left: 120, top: 120, root: { text: 'Release' } })?.getRootNode()const child = root?.addChild({ text: 'QA', side: univerAPI.Enum.BoardMindMapNodeSide.Right })if (!child) throw new Error('Cannot add child')Types: FBoardMindMapNode · IBoardMindMapFacadeAddChildOptions
Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMapNode.addSibling
Adds a sibling beside this node and persists generated ids for both the node and its incoming connector.
Root nodes cannot have siblings. The new node inherits this node's branch side and is inserted after it unless
placement: 'before' is requested.
addSibling(options: IBoardMindMapFacadeAddSiblingOptions): FBoardMindMapNode | nullParameters
options— Required. Stable identity, text, connector id, and relative placement.
Returns
The new sibling facade, or null when this is a root node, a id already exists, or the operation fails.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const child = board .insertMindMap({ left: 120, top: 120, root: { text: 'Release', children: [{ text: 'QA' }] } }) ?.getRootNode() ?.getChildren()[0]const sibling = child?.addSibling({ text: 'Launch', placement: 'after' })if (!sibling) throw new Error('Cannot add sibling')Types: FBoardMindMapNode · IBoardMindMapFacadeAddSiblingOptions
Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMapNode.detachAsMindMap
Detaches this node and its descendants as a new independently addressable mind map.
The subtree keeps all node ids. The new container id is written by the detach operation itself, so collaboration, undo/redo, and immediate id lookup observe one atomic structural change.
detachAsMindMap(options: IBoardMindMapFacadeDetachOptions): booleanParameters
options— Required. generated id and optional position for the new mind map.
Returns
true when this is a non-root node, the new id is unused, and detaching succeeds.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const child = board .insertMindMap({ left: 120, top: 120, root: { text: 'Release', children: [{ text: 'QA' }] } }) ?.getRootNode() ?.getChildren()[0]if (!child || !child.detachAsMindMap({ left: 520, top: 120 })) throw new Error('Cannot detach subtree')Types: IBoardMindMapFacadeDetachOptions
Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMapNode.getChildren
Gets direct child nodes in semantic sibling order.
getChildren(): FBoardMindMapNode[]Returns
Direct child facades sorted by their mind-map order keys.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const root = board .insertMindMap({ left: 120, top: 120, root: { text: 'Release', children: [{ text: 'QA' }, { text: 'Launch' }] }, }) ?.getRootNode()if (!root) throw new Error('Cannot insert mind map')console.log(root.getChildren().map((node) => node.getText()))Types: FBoardMindMapNode
Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMapNode.getDescendants
Gets all descendants of this node in deterministic depth-first tree order.
getDescendants(): FBoardMindMapNode[]Returns
Descendant node facades, excluding this node.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const root = board .insertMindMap({ left: 120, top: 120, root: { text: 'Release', children: [{ text: 'QA', children: [{ text: 'Automation' }] }] }, }) ?.getRootNode()if (!root) throw new Error('Cannot insert mind map')console.log(root.getDescendants().map((node) => node.getText()))Types: FBoardMindMapNode
Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMapNode.getId
Gets the generated node element id.
Prefer getId() for agent references; this id is intended for event payloads and low-level integrations.
getId(): stringReturns
Generated node element id.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const root = board.insertMindMap({ left: 120, top: 120, root: { text: 'Release' } })?.getRootNode()if (!root) throw new Error('Cannot insert mind map')console.log(root.getId())Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMapNode.getIncomingConnectorStyle
Gets the style of the managed connector entering this node.
getIncomingConnectorStyle(): IBoardMindMapFacadeIncomingConnectorStylePatch | nullReturns
A detached connector style, or null for the root, a removed node, or a missing managed connector.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const child = board .insertMindMap({ left: 120, top: 120, root: { text: 'Release', children: [{ text: 'QA' }] } }) ?.getRootNode() ?.getChildren()[0]if (!child) throw new Error('Cannot insert child')console.log(child.getIncomingConnectorStyle())Types: IBoardMindMapFacadeIncomingConnectorStylePatch
Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMapNode.getParent
Gets this node's parent in the same mind map.
getParent(): FBoardMindMapNode | nullReturns
Parent node facade, or null for the root or a removed node.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const child = board .insertMindMap({ left: 120, top: 120, root: { text: 'Release', children: [{ text: 'QA' }] } }) ?.getRootNode() ?.getChildren()[0]if (!child) throw new Error('Cannot insert child')console.log(child.getParent()?.getText())Types: FBoardMindMapNode
Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMapNode.getRichText
Gets node content as a Univer rich-text value.
The returned value is detached from the Board snapshot and can be copied or transformed safely before calling
setText(). Plain nodes also have standard document data, so this method normally returns a value for every valid
node.
getRichText(): RichTextValue | nullReturns
Rich-text value for the node, or null when the node or its document data is unavailable.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const root = board.insertMindMap({ left: 120, top: 120, root: { text: 'Release' } })?.getRootNode()if (!root) throw new Error('Cannot insert mind map')console.log(root.getRichText()?.getData())Types: RichTextValue
Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMapNode.getStyle
Gets a detached snapshot of this node's editable visual style.
getStyle(): IBoardMindMapFacadeNodeStyle | nullReturns
Stable shape and text style fields, or null when the node has been removed.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const root = board.insertMindMap({ left: 120, top: 120, root: { text: 'Release' } })?.getRootNode()if (!root) throw new Error('Cannot insert mind map')console.log(root.getStyle())Types: IBoardMindMapFacadeNodeStyle
Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMapNode.getText
Gets plain node text.
getText(): stringReturns
Current node text, or an empty string when the node is no longer present.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const root = board.insertMindMap({ left: 120, top: 120, root: { text: 'Release' } })?.getRootNode()if (!root) throw new Error('Cannot insert mind map')console.log(root.getText())Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMapNode.isCollapsed
Gets whether the node's descendants are collapsed.
isCollapsed(): boolean | nullReturns
true when descendants are hidden, false when expanded, or null when the node no longer exists.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const root = board .insertMindMap({ left: 120, top: 120, root: { text: 'Release', children: [{ text: 'QA' }] } }) ?.getRootNode()if (!root) throw new Error('Cannot insert mind map')console.log(root.isCollapsed())Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMapNode.moveAfter
Moves this node after a sibling addressed by generated id.
moveAfter(referenceId: string): booleanParameters
referenceId— Required. Generated id of an existing sibling.
Returns
true when both nodes share a parent and the reorder succeeds.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const root = board .insertMindMap({ left: 120, top: 120, root: { text: 'Release', children: [{ text: 'QA' }, { text: 'Launch' }] }, }) ?.getRootNode()const [qa, launch] = root?.getChildren() ?? []if (!qa || !launch || !qa.moveAfter(launch.getId())) throw new Error('Cannot reorder node')Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMapNode.moveBefore
Moves this node before a sibling addressed by generated id.
moveBefore(referenceId: string): booleanParameters
referenceId— Required. Generated id of an existing sibling.
Returns
true when both nodes share a parent and the reorder succeeds.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const root = board .insertMindMap({ left: 120, top: 120, root: { text: 'Release', children: [{ text: 'QA' }, { text: 'Launch' }] }, }) ?.getRootNode()const [qa, launch] = root?.getChildren() ?? []if (!qa || !launch || !launch.moveBefore(qa.getId())) throw new Error('Cannot reorder node')Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMapNode.promote
Promotes this node and its subtree one hierarchy level toward the root.
The operation is available only when both a parent and grandparent exist. It preserves generated ids and recomputes the affected mind-map layout and managed branch geometry.
promote(): booleanReturns
true when the node can be promoted and the operation succeeds.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const root = board .insertMindMap({ left: 120, top: 120, root: { text: 'Release', children: [{ text: 'QA', children: [{ text: 'Automation' }] }] }, }) ?.getRootNode()const nested = root?.getChildren()[0]?.getChildren()[0]if (!nested || !nested.promote()) throw new Error('Cannot promote node')Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMapNode.remove
Removes this node and its entire descendant subtree.
Removing the root also removes the structured mind-map container. The operation is collaborative and undoable.
remove(): booleanReturns
true when the node exists and removal succeeds.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const child = board .insertMindMap({ left: 120, top: 120, root: { text: 'Release', children: [{ text: 'QA' }] } }) ?.getRootNode() ?.getChildren()[0]if (!child || !child.remove()) throw new Error('Cannot remove node')Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMapNode.reparentTo
Moves this node and its subtree under another node in the same mind map.
The mind-map operation prevents cycles and recalculates layout and managed branch geometry.
reparentTo(parentId: string): booleanParameters
parentId— Required. generated id of the new parent node.
Returns
true when both nodes exist in this mind map and reparenting succeeds.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const root = board .insertMindMap({ left: 120, top: 120, root: { text: 'Release', children: [{ text: 'QA' }, { text: 'Launch' }] }, }) ?.getRootNode()const [qa, launch] = root?.getChildren() ?? []if (!qa || !launch || !qa.reparentTo(launch.getId())) throw new Error('Cannot reparent node')Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMapNode.setCollapsed
Collapses or expands this node's descendants.
setCollapsed(collapsed: boolean): booleanParameters
collapsed— Required.trueto collapse descendants;falseto expand them.
Returns
true when the operation succeeds or the node is already in the requested state; false when missing.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const root = board .insertMindMap({ left: 120, top: 120, root: { text: 'Release', children: [{ text: 'QA' }] } }) ?.getRootNode()if (!root || !root.setCollapsed(true)) throw new Error('Cannot collapse node')Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMapNode.setIncomingConnectorStyle
Patches the managed connector entering this node.
setIncomingConnectorStyle(patch: IBoardMindMapFacadeIncomingConnectorStylePatch): booleanParameters
patch— Required. Connector color, width, markers, dash semantics, and other supported style fields.
Returns
true when this is a non-root node and the operation succeeds.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const child = board .insertMindMap({ left: 120, top: 120, root: { text: 'Release', children: [{ text: 'QA' }] } }) ?.getRootNode() ?.getChildren()[0]if ( !child || !child.setIncomingConnectorStyle({ stroke: '#4f46e5', strokeWidth: 2, lineType: 'dash' })) { throw new Error('Cannot style branch')}Types: IBoardMindMapFacadeIncomingConnectorStylePatch
Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMapNode.setStyle
Patches this node's shape and text style while preserving its structure and content.
Text-affecting style changes recompute intrinsic node size and run mind-map layout once inside the operation.
setStyle(patch: IBoardMindMapFacadeNodeStylePatch): booleanParameters
patch— Required. Node visual style fields to change.
Returns
true when the node exists, the patch is non-empty, and the operation succeeds.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const root = board.insertMindMap({ left: 120, top: 120, root: { text: 'Release' } })?.getRootNode()if (!root || !root.setStyle({ fillColor: '#e0e7ff', strokeColor: '#4f46e5' })) { throw new Error('Cannot style node')}Types: IBoardMindMapFacadeNodeStylePatch
Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMapNode.setText
Updates node text and lets the structured mind map operation recompute node size and layout.
setText(text: BoardFacadeTextContent): booleanParameters
text— Required. New plain or rich text. UseuniverAPI.newRichText()for styled content.
Returns
true when the operation succeeds or the text is already current; false when the node is missing.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const root = board.insertMindMap({ left: 120, top: 120, root: { text: 'Release' } })?.getRootNode()if (!root || !root.setText('Release plan')) throw new Error('Cannot update node text')Types: BoardFacadeTextContent
Package: @univerjs-pro/boards-mind · Type definitions
你觉得这篇文档如何?