BlockSuite API Documentation / @blocksuite/blocks / GroupElementModel
Class: GroupElementModel
Extends
GroupLikeModel
<GroupElementProps
>
Constructors
new GroupElementModel(options)
new GroupElementModel(
options
):GroupElementModel
Parameters
• options
• options.id: string
• options.model: SurfaceBlockModel
• options.onChange
• options.stashedStore: Map
<unknown
, unknown
>
• options.yMap: Map
<unknown
>
Returns
Inherited from
GroupLikeModel<GroupElementProps>.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
_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
_stashed
protected
_stashed:Map
<string
,unknown
>
Inherited from
GroupLikeModel._stashed
Source
packages/blocks/src/surface-block/element-model/base.ts:69
children
children:
Map
<boolean
>
Overrides
GroupLikeModel.children
Source
packages/blocks/src/surface-block/element-model/group.ts:45
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
opacity
opacity:
number
=1
Inherited from
GroupLikeModel.opacity
Source
packages/blocks/src/surface-block/element-model/base.ts:98
seed
seed:
number
Inherited from
GroupLikeModel.seed
Source
packages/blocks/src/surface-block/element-model/base.ts:92
showTitle
showTitle:
boolean
=true
Source
packages/blocks/src/surface-block/element-model/group.ts:51
surface
surface:
SurfaceBlockModel
Inherited from
GroupLikeModel.surface
Source
packages/blocks/src/surface-block/element-model/base.ts:80
title
title:
Text
Source
packages/blocks/src/surface-block/element-model/group.ts:48
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/group.ts:59
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
rotate
get
rotate():number
set
rotate(_
):void
Parameters
• _: number
Returns
number
Source
packages/blocks/src/surface-block/element-model/group.ts:53
type
get
type():string
Returns
string
Source
packages/blocks/src/surface-block/element-model/group.ts:63
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
addChild()
addChild(
element
):void
Parameters
• element: string
| EdgelessModel
Returns
void
Source
packages/blocks/src/surface-block/element-model/group.ts:67
boxSelect()
boxSelect(
bound
):boolean
Parameters
• bound: Bound
Returns
boolean
Inherited from
GroupLikeModel.boxSelect
Source
packages/blocks/src/surface-block/element-model/base.ts:297
containedByBounds()
containedByBounds(
bound
):boolean
Parameters
• bound: Bound
Returns
boolean
Overrides
GroupLikeModel.containedByBounds
Source
packages/blocks/src/surface-block/element-model/group.ts:83
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
getNearestPoint()
getNearestPoint(
point
):IVec
Parameters
• point: IVec
Returns
IVec
Inherited from
GroupLikeModel.getNearestPoint
Source
packages/blocks/src/surface-block/element-model/base.ts:278
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: IVec2
• end: IVec2
Returns
null
| PointLocation
[]
Overrides
GroupLikeModel.intersectWithLine
Source
packages/blocks/src/surface-block/element-model/group.ts:87
onCreated()
onCreated():
void
onCreated
function will be executed when element is created in local rather than remote peers
Returns
void
Inherited from
GroupLikeModel.onCreated
Source
packages/blocks/src/surface-block/element-model/base.ts:318
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(
element
):void
Parameters
• element: string
| EdgelessModel
Returns
void
Overrides
GroupLikeModel.removeDescendant
Source
packages/blocks/src/surface-block/element-model/group.ts:75
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
):GroupElementProps
Parameters
• props: GroupElementProps
Returns
GroupElementProps
Overrides
GroupLikeModel.propsToY
Source
packages/blocks/src/surface-block/element-model/group.ts:20