Skip to content

BlockSuite API Documentation / @blocksuite/block-std / BlockSpec

Interface: BlockSpec<WidgetNames, Service>

Type parameters

WidgetNames extends string = string

Service extends BlockService = BlockService

Properties

schema

schema: object

model

model: object

model.children?

optional children: string[]

model.flavour

flavour: string

model.parent?

optional parent: string[]

model.props()?

optional props: (args_0, ...args_1) => Record<string, any>

Parameters

args_0: InternalPrimitives

• ...args_1: unknown[]

Returns

Record<string, any>

model.role

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

model.toModel()?

optional toModel: (...args) => BlockModel<object>

Parameters

• ...args: unknown[]

Returns

BlockModel<object>

onUpgrade()?

optional onUpgrade: (args_0, args_1, args_2, ...args_3) => void

Parameters

args_0: any

args_1: number

args_2: number

• ...args_3: unknown[]

Returns

void

transformer()?

optional transformer: (...args) => BaseBlockTransformer<object>

Parameters

• ...args: unknown[]

Returns

BaseBlockTransformer<object>

version

version: number

Source

packages/framework/block-std/src/spec/type.ts:17


service?

optional service: BlockServiceConstructor<Service>

Source

packages/framework/block-std/src/spec/type.ts:18


setup()?

optional setup: (slots, disposableGroup) => void

Parameters

slots: BlockSpecSlots

disposableGroup: DisposableGroup

Returns

void

Source

packages/framework/block-std/src/spec/type.ts:20


view

view: BlockView<WidgetNames>

Source

packages/framework/block-std/src/spec/type.ts:19