API 参考

FBoardMindMapNode

本 API 页面目前提供英文正文。代码签名与标识符不随界面语言变化。

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:

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.

TypeScript
addChild(options: IBoardMindMapFacadeAddChildOptions): FBoardMindMapNode | null

Parameters

  • options — Required. Child text, generated ids, and optional side.

Returns

New child facade, or null when the operation fails.

Examples

TypeScript
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.

TypeScript
addSibling(options: IBoardMindMapFacadeAddSiblingOptions): FBoardMindMapNode | null

Parameters

  • 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

TypeScript
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.

TypeScript
detachAsMindMap(options: IBoardMindMapFacadeDetachOptions): boolean

Parameters

  • 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

TypeScript
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.

TypeScript
getChildren(): FBoardMindMapNode[]

Returns

Direct child facades sorted by their mind-map order keys.

Examples

TypeScript
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.

TypeScript
getDescendants(): FBoardMindMapNode[]

Returns

Descendant node facades, excluding this node.

Examples

TypeScript
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.

TypeScript
getId(): string

Returns

Generated node element id.

Examples

TypeScript
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.

TypeScript
getIncomingConnectorStyle(): IBoardMindMapFacadeIncomingConnectorStylePatch | null

Returns

A detached connector style, or null for the root, a removed node, or a missing managed connector.

Examples

TypeScript
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.

TypeScript
getParent(): FBoardMindMapNode | null

Returns

Parent node facade, or null for the root or a removed node.

Examples

TypeScript
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.

TypeScript
getRichText(): RichTextValue | null

Returns

Rich-text value for the node, or null when the node or its document data is unavailable.

Examples

TypeScript
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.

TypeScript
getStyle(): IBoardMindMapFacadeNodeStyle | null

Returns

Stable shape and text style fields, or null when the node has been removed.

Examples

TypeScript
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.

TypeScript
getText(): string

Returns

Current node text, or an empty string when the node is no longer present.

Examples

TypeScript
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.

TypeScript
isCollapsed(): boolean | null

Returns

true when descendants are hidden, false when expanded, or null when the node no longer exists.

Examples

TypeScript
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.

TypeScript
moveAfter(referenceId: string): boolean

Parameters

  • referenceId — Required. Generated id of an existing sibling.

Returns

true when both nodes share a parent and the reorder succeeds.

Examples

TypeScript
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.

TypeScript
moveBefore(referenceId: string): boolean

Parameters

  • referenceId — Required. Generated id of an existing sibling.

Returns

true when both nodes share a parent and the reorder succeeds.

Examples

TypeScript
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.

TypeScript
promote(): boolean

Returns

true when the node can be promoted and the operation succeeds.

Examples

TypeScript
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.

TypeScript
remove(): boolean

Returns

true when the node exists and removal succeeds.

Examples

TypeScript
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.

TypeScript
reparentTo(parentId: string): boolean

Parameters

  • parentId — Required. generated id of the new parent node.

Returns

true when both nodes exist in this mind map and reparenting succeeds.

Examples

TypeScript
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.

TypeScript
setCollapsed(collapsed: boolean): boolean

Parameters

  • collapsed — Required. true to collapse descendants; false to expand them.

Returns

true when the operation succeeds or the node is already in the requested state; false when missing.

Examples

TypeScript
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.

TypeScript
setIncomingConnectorStyle(patch: IBoardMindMapFacadeIncomingConnectorStylePatch): boolean

Parameters

  • 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

TypeScript
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.

TypeScript
setStyle(patch: IBoardMindMapFacadeNodeStylePatch): boolean

Parameters

  • patch — Required. Node visual style fields to change.

Returns

true when the node exists, the patch is non-empty, and the operation succeeds.

Examples

TypeScript
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.

TypeScript
setText(text: BoardFacadeTextContent): boolean

Parameters

  • text — Required. New plain or rich text. Use univerAPI.newRichText() for styled content.

Returns

true when the operation succeeds or the text is already current; false when the node is missing.

Examples

TypeScript
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

你觉得这篇文档如何?

© 2026 DreamNum Co., Ltd.