BlockSuite API Documentation / @blocksuite/blocks / MindmapElementModel
Class: MindmapElementModel
Extends
GroupLikeModel
<MindmapElementProps
>
Constructors
new MindmapElementModel(options)
new MindmapElementModel(
options
):MindmapElementModel
Parameters
• options
• options.id: string
• options.model: SurfaceBlockModel
• options.onChange
• options.stashedStore: Map
<unknown
, unknown
>
• options.yMap: Map
<unknown
>
Returns
Inherited from
GroupLikeModel<MindmapElementProps>.constructor
Source
packages/blocks/src/surface-block/element-model/base.ts:118
Properties
_disposable
protected
_disposable:DisposableGroup
Inherited from
GroupLikeModel._disposable
Source
packages/blocks/src/surface-block/element-model/base.ts:76
_id
protected
_id:string
Inherited from
GroupLikeModel._id
Source
packages/blocks/src/surface-block/element-model/base.ts:77
_local
protected
_local:Map
<string
|symbol
,unknown
>
Inherited from
GroupLikeModel._local
Source
packages/blocks/src/surface-block/element-model/base.ts:70
_nodeMap
private
_nodeMap:Map
<string
,MindmapNode
>
Source
packages/blocks/src/surface-block/element-model/mindmap.ts:157
_onChange()
protected
_onChange: (payload
) =>void
Parameters
• payload
• payload.local: boolean
• payload.oldValues: Record
<string
, unknown
>
• payload.props: Record
<string
, unknown
>
Returns
void
Inherited from
GroupLikeModel._onChange
Source
packages/blocks/src/surface-block/element-model/base.ts:71
_preserved
protected
_preserved:Map
<string
,unknown
>
When the ymap is not connected to the doc, its value cannot be read. But we need to use those value during the creation, so the yfied decorated field's value will be stored in this map too during the creation.
After the ymap is connected to the doc, this map will be cleared.
Inherited from
GroupLikeModel._preserved
Source
packages/blocks/src/surface-block/element-model/base.ts:68
_queued
private
_queued:boolean
=false
Source
packages/blocks/src/surface-block/element-model/mindmap.ts:509
_stashed
protected
_stashed:Map
<string
,unknown
>
Inherited from
GroupLikeModel._stashed
Source
packages/blocks/src/surface-block/element-model/base.ts:69
_tree
private
_tree:MindmapRoot
Source
packages/blocks/src/surface-block/element-model/mindmap.ts:155
children
children:
Map
<NodeDetail
>
Overrides
GroupLikeModel.children
Source
packages/blocks/src/surface-block/element-model/mindmap.ts:119
connectors
connectors:
Map
<string
,LocalConnectorElementModel
>
Source
packages/blocks/src/surface-block/element-model/mindmap.ts:153
display
display:
boolean
=true
Inherited from
GroupLikeModel.display
Source
packages/blocks/src/surface-block/element-model/base.ts:95
externalXYWH
externalXYWH:
undefined
|[${number},${number},${number},${number}]
=undefined
Inherited from
GroupLikeModel.externalXYWH
Source
packages/blocks/src/surface-block/element-model/base.ts:104
index
index:
string
Inherited from
GroupLikeModel.index
Source
packages/blocks/src/surface-block/element-model/base.ts:89
layoutType
layoutType:
LayoutType
=LayoutType.BALANCE
Source
packages/blocks/src/surface-block/element-model/mindmap.ts:143
opacity
opacity:
number
=1
Inherited from
GroupLikeModel.opacity
Source
packages/blocks/src/surface-block/element-model/base.ts:98
pathGenerator
pathGenerator:
ConnectorPathGenerator
Source
packages/blocks/src/surface-block/element-model/mindmap.ts:63
seed
seed:
number
Inherited from
GroupLikeModel.seed
Source
packages/blocks/src/surface-block/element-model/base.ts:92
style
style:
MindmapStyle
=MindmapStyle.FOUR
Source
packages/blocks/src/surface-block/element-model/mindmap.ts:151
surface
surface:
SurfaceBlockModel
Inherited from
GroupLikeModel.surface
Source
packages/blocks/src/surface-block/element-model/base.ts:80
xywh
xywh:
[${number},${number},${number},${number}]
='[0,0,0,0]'
Inherited from
GroupLikeModel.xywh
Source
packages/blocks/src/surface-block/element-model/base.ts:384
yMap
yMap:
Map
<unknown
>
Inherited from
GroupLikeModel.yMap
Source
packages/blocks/src/surface-block/element-model/base.ts:79
Accessors
childElements
get
childElements():EdgelessModel
[]
Returns
Source
packages/blocks/src/surface-block/element-model/base.ts:369
childIds
get
childIds():string
[]
The ids of the children. Its role is to provide a unique way to access the children. You should update this field through setChildIds
when the children are added or removed.
Returns
string
[]
Source
packages/blocks/src/surface-block/element-model/base.ts:334
connectable
get
connectable():boolean
Returns
boolean
Source
packages/blocks/src/surface-block/element-model/base.ts:143
deserializedXYWH
get
deserializedXYWH():XYWH
Returns
XYWH
Source
packages/blocks/src/surface-block/element-model/base.ts:149
elementBound
get
elementBound():Bound
Returns
Source
packages/blocks/src/surface-block/element-model/base.ts:187
externalBound
get
externalBound():null
|Bound
Returns
null
| Bound
Source
packages/blocks/src/surface-block/element-model/base.ts:106
group
get
group():null
|GroupLikeModel
<BaseProps
>
Returns
null
| GroupLikeModel
<BaseProps
>
Source
packages/blocks/src/surface-block/element-model/base.ts:175
groups
get
groups():GroupLikeModel
<BaseProps
>[]
Returns
GroupLikeModel
<BaseProps
>[]
Source
packages/blocks/src/surface-block/element-model/base.ts:179
h
get
h():number
Returns
number
Source
packages/blocks/src/surface-block/element-model/base.ts:171
id
get
id():string
Returns
string
Source
packages/blocks/src/surface-block/element-model/base.ts:183
nodeMap
get
nodeMap():Map
<string
,MindmapNode
>
Returns
Map
<string
, MindmapNode
>
Source
packages/blocks/src/surface-block/element-model/mindmap.ts:163
rotate
get
rotate():number
set
rotate(_
):void
Parameters
• _: number
Returns
number
Source
packages/blocks/src/surface-block/element-model/mindmap.ts:167
styleGetter
get
styleGetter():MindmapStyleGetter
Returns
MindmapStyleGetter
Source
packages/blocks/src/surface-block/element-model/mindmap.ts:173
tree
get
tree():MindmapRoot
Returns
MindmapRoot
Source
packages/blocks/src/surface-block/element-model/mindmap.ts:159
type
get
type():string
Returns
string
Source
packages/blocks/src/surface-block/element-model/mindmap.ts:54
w
get
w():number
Returns
number
Source
packages/blocks/src/surface-block/element-model/base.ts:167
x
get
x():number
Returns
number
Source
packages/blocks/src/surface-block/element-model/base.ts:159
y
get
y():number
Returns
number
Source
packages/blocks/src/surface-block/element-model/base.ts:163
Methods
_cfgBalanceLayoutDir()
private
_cfgBalanceLayoutDir():void
Returns
void
Source
packages/blocks/src/surface-block/element-model/mindmap.ts:238
addConnector()
protected
addConnector(from
,to
,layout
,connectorStyle
):void
Parameters
• from: MindmapNode
• to: MindmapNode
• layout: LayoutType
• connectorStyle: ConnectorStyle
Returns
void
Source
packages/blocks/src/surface-block/element-model/mindmap.ts:451
addNode()
addNode(
parent
,type
,sibling
?,position
?,props
?,direction
?):string
Parameters
• parent: null
| string
The parent node id of the new node. If it's null, the node will be the root node
• type: "shape"
• sibling?: string
• position?: "before"
| "after"
= 'after'
• props?: Record
<string
, unknown
>= {}
• direction?: RIGHT
| LEFT
Force the layout direction of the node. It only works on the first level node with the layout type of BALANCE
Returns
string
Source
packages/blocks/src/surface-block/element-model/mindmap.ts:287
applyStyle()
applyStyle():
void
Returns
void
Source
packages/blocks/src/surface-block/element-model/mindmap.ts:522
boxSelect()
boxSelect(
bound
):boolean
Parameters
• bound: Bound
Returns
boolean
Inherited from
GroupLikeModel.boxSelect
Source
packages/blocks/src/surface-block/element-model/base.ts:297
buildTree()
protected
buildTree():void
Returns
void
Source
packages/blocks/src/surface-block/element-model/mindmap.ts:177
calcConnection()
calcConnection():
void
Returns
void
Source
packages/blocks/src/surface-block/element-model/mindmap.ts:423
containedByBounds()
containedByBounds(
bounds
):boolean
Parameters
• bounds: Bound
Returns
boolean
Inherited from
GroupLikeModel.containedByBounds
Source
packages/blocks/src/surface-block/element-model/base.ts:272
decendants()
decendants(
withoutGroup
):EdgelessModel
[]
Get all decendants of this group
Parameters
• withoutGroup: boolean
= true
if true, will not include group element
Returns
Inherited from
GroupLikeModel.decendants
Source
packages/blocks/src/surface-block/element-model/base.ts:402
getLayoutDir()
getLayoutDir(
element
):null
|LayoutType
Parameters
• element: string
| EdgelessModel
Returns
null
| LayoutType
Source
packages/blocks/src/surface-block/element-model/mindmap.ts:484
getNearestPoint()
getNearestPoint(
point
):IVec
Parameters
• point: IVec
Returns
IVec
Inherited from
GroupLikeModel.getNearestPoint
Source
packages/blocks/src/surface-block/element-model/base.ts:278
getParentNode()
getParentNode(
id
):null
|ElementModel
<BaseProps
>
Parameters
• id: string
Returns
null
| ElementModel
<BaseProps
>
Source
packages/blocks/src/surface-block/element-model/mindmap.ts:258
getPath()
getPath(
element
):number
[]
Parameters
• element: string
| MindmapNode
Returns
number
[]
Source
packages/blocks/src/surface-block/element-model/mindmap.ts:264
getRelativePointLocation()
getRelativePointLocation(
relativePoint
):PointLocation
Parameters
• relativePoint: IVec
Returns
PointLocation
Inherited from
GroupLikeModel.getRelativePointLocation
Source
packages/blocks/src/surface-block/element-model/base.ts:288
hasDescendant()
hasDescendant(
element
):boolean
Check if the element has the descendant
Parameters
• element: string
| EdgelessModel
Returns
boolean
Inherited from
GroupLikeModel.hasDescendant
Source
packages/blocks/src/surface-block/element-model/base.ts:389
hitTest()
hitTest(
x
,y
,_
,__
):boolean
Parameters
• x: number
• y: number
• _: HitTestOptions
• __: EditorHost
Returns
boolean
Inherited from
GroupLikeModel.hitTest
Source
packages/blocks/src/surface-block/element-model/base.ts:306
intersectWithLine()
intersectWithLine(
start
,end
):null
|PointLocation
[]
Parameters
• start: IVec
• end: IVec
Returns
null
| PointLocation
[]
Inherited from
GroupLikeModel.intersectWithLine
Source
packages/blocks/src/surface-block/element-model/base.ts:283
layout()
layout():
void
Returns
void
Source
packages/blocks/src/surface-block/element-model/mindmap.ts:415
moveTo()
moveTo(
targetXYWH
):void
Parameters
• targetXYWH: XYWH
| [${number},${number},${number},${number}]
Returns
void
Source
packages/blocks/src/surface-block/element-model/mindmap.ts:550
onCreated()
onCreated():
void
Returns
void
Overrides
GroupLikeModel.onCreated
Source
packages/blocks/src/surface-block/element-model/mindmap.ts:58
pop()
pop(
prop
):void
Parameters
• prop: string
Returns
void
Inherited from
GroupLikeModel.pop
Source
packages/blocks/src/surface-block/element-model/base.ts:250
removeDescendant()
removeDescendant(
id
,transaction
):void
Parameters
• id: string
• transaction: boolean
= true
Returns
void
Overrides
GroupLikeModel.removeDescendant
Source
packages/blocks/src/surface-block/element-model/mindmap.ts:392
requestLayout()
requestLayout():
void
Returns
void
Source
packages/blocks/src/surface-block/element-model/mindmap.ts:511
serialize()
serialize():
object
Returns
object
Inherited from
GroupLikeModel.serialize
Source
packages/blocks/src/surface-block/element-model/base.ts:310
setChildIds()
protected
setChildIds(value
,fromLocal
):void
Set the new value of the childIds
Parameters
• value: string
[]
the new value of the childIds
• fromLocal: boolean
if true, the change is happend in the local
Returns
void
Inherited from
GroupLikeModel.setChildIds
Source
packages/blocks/src/surface-block/element-model/base.ts:344
stash()
stash(
prop
):void
Parameters
• prop: string
Returns
void
Inherited from
GroupLikeModel.stash
Source
packages/blocks/src/surface-block/element-model/base.ts:195
propsToY()
static
propsToY(props
):Record
<string
,unknown
>
Parameters
• props: Record
<string
, unknown
>
Returns
Record
<string
, unknown
>
Inherited from
GroupLikeModel.propsToY
Source
packages/blocks/src/surface-block/element-model/base.ts:57