Skip to content

BlockSuite API Documentation / @blocksuite/blocks / SurfaceBlockModel

Class: SurfaceBlockModel

Extends

  • SurfaceBlockModel

Constructors

new SurfaceBlockModel()

new SurfaceBlockModel(): SurfaceBlockModel

Returns

SurfaceBlockModel

Inherited from

BaseSurfaceModel.constructor

Defined in

packages/framework/block-std/dist/gfx/surface/surface-model.d.ts:56

Properties

_decoratorState

protected _decoratorState: object

creating

creating: boolean

deriving

deriving: boolean

skipField

skipField: boolean

Inherited from

BaseSurfaceModel._decoratorState

Defined in

packages/framework/block-std/dist/gfx/surface/surface-model.d.ts:16


_elementCtorMap

protected _elementCtorMap: Record<string, Constructor<SurfaceElementModel<BaseElementProps>, [object]>>

Inherited from

BaseSurfaceModel._elementCtorMap

Defined in

packages/framework/block-std/dist/gfx/surface/surface-model.d.ts:21


_elementModels

protected _elementModels: Map<string, object>

Inherited from

BaseSurfaceModel._elementModels

Defined in

packages/framework/block-std/dist/gfx/surface/surface-model.d.ts:22


_elementToGroup

protected _elementToGroup: Map<string, string>

Inherited from

BaseSurfaceModel._elementToGroup

Defined in

packages/framework/block-std/dist/gfx/surface/surface-model.d.ts:27


_elementTypeMap

protected _elementTypeMap: Map<string, SurfaceElementModel<BaseElementProps>[]>

Inherited from

BaseSurfaceModel._elementTypeMap

Defined in

packages/framework/block-std/dist/gfx/surface/surface-model.d.ts:28


_groupToElements

protected _groupToElements: Map<string, string[]>

Inherited from

BaseSurfaceModel._groupToElements

Defined in

packages/framework/block-std/dist/gfx/surface/surface-model.d.ts:29


_surfaceBlockModel

protected _surfaceBlockModel: boolean

Inherited from

BaseSurfaceModel._surfaceBlockModel

Defined in

packages/framework/block-std/dist/gfx/surface/surface-model.d.ts:30


[modelLabel]

[modelLabel]: SurfaceBlockProps

Inherited from

BaseSurfaceModel.[modelLabel]

Defined in

packages/framework/store/dist/schema/base.d.ts:116


childMap

childMap: ReadonlySignal<Map<string, number>>

Inherited from

BaseSurfaceModel.childMap

Defined in

packages/framework/store/dist/schema/base.d.ts:109


created

created: Slot<void>

Inherited from

BaseSurfaceModel.created

Defined in

packages/framework/store/dist/schema/base.d.ts:110


deleted

deleted: Slot<void>

Inherited from

BaseSurfaceModel.deleted

Defined in

packages/framework/store/dist/schema/base.d.ts:111


elementAdded

elementAdded: Slot<object>

Type declaration

id

id: string

local

local: boolean

Inherited from

BaseSurfaceModel.elementAdded

Defined in

packages/framework/block-std/dist/gfx/surface/surface-model.d.ts:31


elementRemoved

elementRemoved: Slot<object>

Type declaration

id

id: string

local

local: boolean

model

model: SurfaceElementModel<BaseElementProps>

type

type: string

Inherited from

BaseSurfaceModel.elementRemoved

Defined in

packages/framework/block-std/dist/gfx/surface/surface-model.d.ts:35


elements

elements: Boxed<YMap<YMap<unknown>>>

Inherited from

BaseSurfaceModel.elements

Defined in

packages/framework/block-std/dist/gfx/surface/surface-model.d.ts:6


elements$

elements$: Signal<Boxed<YMap<YMap<unknown>>>>

Inherited from

BaseSurfaceModel.elements$


elementUpdated

elementUpdated: Slot<ElementUpdatedData>

Inherited from

BaseSurfaceModel.elementUpdated

Defined in

packages/framework/block-std/dist/gfx/surface/surface-model.d.ts:41


flavour

flavour: string

Inherited from

BaseSurfaceModel.flavour

Defined in

packages/framework/store/dist/schema/base.d.ts:112


hooks

protected hooks: object

Hooks is used to attach extra logic when calling addElementupdateElement(or assign property directly) and removeElement. It's useful when dealing with relation between different model.

remove

remove: Slot<object>

Type declaration
id

id: string

model

model: SurfaceElementModel<BaseElementProps>

type

type: string

update

update: Slot<Omit<ElementUpdatedData, "local">>

Inherited from

BaseSurfaceModel.hooks

Defined in

packages/framework/block-std/dist/gfx/surface/surface-model.d.ts:46


id

id: string

Inherited from

BaseSurfaceModel.id

Defined in

packages/framework/store/dist/schema/base.d.ts:113


isEmpty

isEmpty: ReadonlySignal<boolean>

Inherited from

BaseSurfaceModel.isEmpty

Defined in

packages/framework/store/dist/schema/base.d.ts:114


keys

keys: string[]

Inherited from

BaseSurfaceModel.keys

Defined in

packages/framework/store/dist/schema/base.d.ts:115


page

page: Doc

Deprecated

use doc instead

Inherited from

BaseSurfaceModel.page

Defined in

packages/framework/store/dist/schema/base.d.ts:120


pop()

pop: (prop) => void

Parameters

prop: "elements"

Returns

void

Inherited from

BaseSurfaceModel.pop

Defined in

packages/framework/store/dist/schema/base.d.ts:121


propsUpdated

propsUpdated: Slot<object>

Type declaration

key

key: string

Inherited from

BaseSurfaceModel.propsUpdated

Defined in

packages/framework/store/dist/schema/base.d.ts:122


role

role: "root" | "hub" | "content"

Inherited from

BaseSurfaceModel.role

Defined in

packages/framework/store/dist/schema/base.d.ts:125


stash()

stash: (prop) => void

Parameters

prop: "elements"

Returns

void

Inherited from

BaseSurfaceModel.stash

Defined in

packages/framework/store/dist/schema/base.d.ts:126


text?

optional text: Text

Inherited from

BaseSurfaceModel.text

Defined in

packages/framework/store/dist/schema/base.d.ts:127


version

version: number

Inherited from

BaseSurfaceModel.version

Defined in

packages/framework/store/dist/schema/base.d.ts:128


yBlock

yBlock: YBlock

Inherited from

BaseSurfaceModel.yBlock

Defined in

packages/framework/store/dist/schema/base.d.ts:129

Accessors

children

get children(): BlockModel<object, SignaledProps<object>>[]

Returns

BlockModel<object, SignaledProps<object>>[]

Inherited from

BaseSurfaceModel.children

Defined in

packages/framework/store/dist/schema/base.d.ts:130


doc

get doc(): Doc

set doc(doc): void

Parameters

doc: Doc

Returns

Doc

Inherited from

BaseSurfaceModel.doc

Defined in

packages/framework/store/dist/schema/base.d.ts:131


elementModels

get elementModels(): SurfaceElementModel<BaseElementProps>[]

Returns

SurfaceElementModel<BaseElementProps>[]

Inherited from

BaseSurfaceModel.elementModels

Defined in

packages/framework/block-std/dist/gfx/surface/surface-model.d.ts:54


parent

get parent(): null | BlockModel<object, SignaledProps<object>>

Returns

null | BlockModel<object, SignaledProps<object>>

Inherited from

BaseSurfaceModel.parent

Defined in

packages/framework/store/dist/schema/base.d.ts:133


registeredElementTypes

get registeredElementTypes(): string[]

Returns

string[]

Inherited from

BaseSurfaceModel.registeredElementTypes

Defined in

packages/framework/block-std/dist/gfx/surface/surface-model.d.ts:55

Methods

_extendElement()

protected _extendElement(ctorMap): void

Parameters

ctorMap: Record<string, Constructor<SurfaceElementModel<BaseElementProps>, [object]>>

Returns

void

Inherited from

BaseSurfaceModel._extendElement

Defined in

packages/framework/block-std/dist/gfx/surface/surface-model.d.ts:62


_init()

_init(): void

Returns

void

Overrides

BaseSurfaceModel._init

Defined in

packages/affine/block-surface/dist/surface-model.d.ts:22


[dispose]()

[dispose](): void

Returns

void

Inherited from

BaseSurfaceModel.[dispose]

Defined in

packages/framework/store/dist/schema/base.d.ts:138


addElement()

addElement<T>(props): string

Type Parameters

T extends object = Record<string, unknown>

Parameters

props: Partial<T> & object

Returns

string

Inherited from

BaseSurfaceModel.addElement

Defined in

packages/framework/block-std/dist/gfx/surface/surface-model.d.ts:64


applyMiddlewares()

applyMiddlewares(): void

Returns

void

Overrides

BaseSurfaceModel.applyMiddlewares

Defined in

packages/affine/block-surface/dist/surface-model.d.ts:23


dispose()

dispose(): void

Returns

void

Inherited from

BaseSurfaceModel.dispose

Defined in

packages/framework/block-std/dist/gfx/surface/surface-model.d.ts:68


firstChild()

firstChild(): null | BlockModel<object, SignaledProps<object>>

Returns

null | BlockModel<object, SignaledProps<object>>

Inherited from

BaseSurfaceModel.firstChild

Defined in

packages/framework/store/dist/schema/base.d.ts:136


getConnectors()

getConnectors(id): ConnectorElementModel[]

Parameters

id: string

Returns

ConnectorElementModel[]

Defined in

packages/affine/block-surface/dist/surface-model.d.ts:24


getElementById()

getElementById(id): null | SurfaceElementModel<BaseElementProps>

Parameters

id: string

Returns

null | SurfaceElementModel<BaseElementProps>

Inherited from

BaseSurfaceModel.getElementById

Defined in

packages/framework/block-std/dist/gfx/surface/surface-model.d.ts:69


getElementsByType()

getElementsByType<K>(type): SurfaceElementModelMap[K][]

Type Parameters

K extends keyof SurfaceElementModelMap

Parameters

type: K

Returns

SurfaceElementModelMap[K][]

Overrides

BaseSurfaceModel.getElementsByType

Defined in

packages/affine/block-surface/dist/surface-model.d.ts:25


getGroup()

getGroup<T>(id): null | T

Type Parameters

T extends SurfaceGroupLikeModel<BaseElementProps> = SurfaceGroupLikeModel<BaseElementProps>

Parameters

id: string

Returns

null | T

Inherited from

BaseSurfaceModel.getGroup

Defined in

packages/framework/block-std/dist/gfx/surface/surface-model.d.ts:71


getGroups()

getGroups(id): SurfaceGroupLikeModel<BaseElementProps>[]

Parameters

id: string

Returns

SurfaceGroupLikeModel<BaseElementProps>[]

Inherited from

BaseSurfaceModel.getGroups

Defined in

packages/framework/block-std/dist/gfx/surface/surface-model.d.ts:72


hasElementById()

hasElementById(id): boolean

Parameters

id: string

Returns

boolean

Inherited from

BaseSurfaceModel.hasElementById

Defined in

packages/framework/block-std/dist/gfx/surface/surface-model.d.ts:73


isInMindmap()

isInMindmap(id): boolean

Parameters

id: string

Returns

boolean

Inherited from

BaseSurfaceModel.isInMindmap

Defined in

packages/framework/block-std/dist/gfx/surface/surface-model.d.ts:74


lastChild()

lastChild(): null | BlockModel<object, SignaledProps<object>>

Returns

null | BlockModel<object, SignaledProps<object>>

Inherited from

BaseSurfaceModel.lastChild

Defined in

packages/framework/store/dist/schema/base.d.ts:137


removeElement()

removeElement(id): void

Parameters

id: string

Returns

void

Inherited from

BaseSurfaceModel.removeElement

Defined in

packages/framework/block-std/dist/gfx/surface/surface-model.d.ts:75


updateElement()

updateElement<T>(id, props): void

Type Parameters

T extends object = Record<string, unknown>

Parameters

id: string

props: Partial<T>

Returns

void

Inherited from

BaseSurfaceModel.updateElement

Defined in

packages/framework/block-std/dist/gfx/surface/surface-model.d.ts:76