Skip to content

BlockSuite API Documentation / @blocksuite/blocks / BlocksUtils

Variable: BlocksUtils

const BlocksUtils: object

Type declaration

Point

Point: typeof Point

deserializeXYWH()

deserializeXYWH: (xywh) => XYWH

Parameters

xywh: string

Returns

XYWH

isCanvasElement()

isCanvasElement: (selectable) => selectable is CanvasElement

Parameters

selectable: null | EdgelessModel

Returns

selectable is CanvasElement

matchFlavours()

matchFlavours: <Key>(model, expected) => model is BlockModels[Key[number]]

Type parameters

Key extends keyof BlockModels[]

Parameters

model: null | BlockModel<object>

expected: Key

Returns

model is BlockModels[Key[number]]

mindMap

mindMap: object

mindMap.changeText()

changeText: (id, text, service) => void

Parameters

id: string

text: string

service: EdgelessRootService

Returns

void

mindMap.createNode()

createNode: (text, service, connector?) => string

Parameters

text: string

service: EdgelessRootService

connector?: Connector

Returns

string

mindMap.drawInEdgeless()

drawInEdgeless: (service, mindMap, ops?) => void = drawMindMap

Parameters

service: EdgelessRootService

mindMap: TreeNode

ops?

ops.rootId?: string

ops.x?: number

ops.y?: number

Returns

void

mindMap.layout

layout: object

mindMap.layout.bottom

bottom: Layout = bottomLayout

mindMap.layout.left

left: Layout = leftLayout

mindMap.layout.leftRight

leftRight: Layout = leftRightLayout

mindMap.layout.right

right: Layout = rightLayout

mindMap.layout.top

top: Layout = topLayout

mindMap.layout.topBottom

topBottom: Layout = topBottomLayout

mindMap.layoutInEdgeless()

layoutInEdgeless: (service, mindMap, ops?) => void = layoutMindMap

Parameters

service: EdgelessRootService

mindMap: TreeNodeWithId

ops?

ops.rootId?: string

ops.x?: number

ops.y?: number

Returns

void

splitElements()

splitElements: (elements) => object

Parameters

elements: EdgelessModel[]

Returns

object

frames

frames: FrameBlockModel[]

images

images: ImageBlockModel[]

notes

notes: NoteBlockModel[]

shapes

shapes: CanvasElement[]

Source

packages/blocks/src/index.ts:141