Skip to content

BlockSuite API Documentation / @blocksuite/blocks / EdgelessRootService

Class: EdgelessRootService

Deprecated

BlockService is deprecated. You should reconsider where to put your feature.

BlockService is a legacy extension that is used to provide services to the block. In the previous version of BlockSuite, block service provides a way to extend the block. However, in the new version, we recommend using the new extension system.

Extends

Implements

Constructors

new EdgelessRootService()

new EdgelessRootService(std, flavourProvider): EdgelessRootService

Parameters

std: BlockStdScope

flavourProvider

flavourProvider.flavour: string

Returns

EdgelessRootService

Overrides

RootService.constructor

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:193

Properties

disposables

readonly disposables: DisposableGroup

Inherited from

RootService.disposables

Defined in

packages/framework/block-std/dist/extension/service.d.ts:20


elementRenderers

elementRenderers: Record<string, ElementRenderer>

Implementation of

SurfaceContext.elementRenderers

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:77


fileDropManager

readonly fileDropManager: FileDropManager

Inherited from

RootService.fileDropManager

Defined in

packages/blocks/src/root-block/root-service.ts:25


flavour

readonly flavour: string

Inherited from

RootService.flavour

Defined in

packages/framework/block-std/dist/extension/service.d.ts:21


flavourProvider

readonly flavourProvider: object

flavour

flavour: string

Inherited from

RootService.flavourProvider

Defined in

packages/framework/block-std/dist/extension/service.d.ts:16


overlays

overlays: Record<string, Overlay>

Implementation of

SurfaceContext.overlays

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:79


slots

slots: object

copyAsPng

copyAsPng: Slot<object>

Type declaration
blocks

blocks: EdgelessBlockModelType[]

shapes

shapes: SurfaceModel[]

cursorUpdated

cursorUpdated: Slot<string>

draggingAreaUpdated

draggingAreaUpdated: Slot<void>

edgelessToolUpdated

edgelessToolUpdated: Slot<TextTool | BrushTool | ConnectorTool | ShapeTool | MindmapTool | CopilotSelectionTool | DefaultTool | EraserTool | FrameNavigatorTool | FrameTool | LassoTool | NoteTool | PanTool | object>

elementResizeEnd

elementResizeEnd: Slot<void>

elementResizeStart

elementResizeStart: Slot<void>

fullScreenToggled

fullScreenToggled: Slot<void>

navigatorFrameChanged: Slot<FrameBlockModel>

navigatorSettingUpdated: Slot<object>

Type declaration
blackBackground?

optional blackBackground: boolean

fillScreen?

optional fillScreen: boolean

hideToolbar?

optional hideToolbar: boolean

pressShiftKeyUpdated

pressShiftKeyUpdated: Slot<boolean>

readonlyUpdated

readonlyUpdated: Slot<boolean>

toggleNoteSlicer

toggleNoteSlicer: Slot<void>

toolbarLocked

toolbarLocked: Slot<boolean>

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:84


specSlots

readonly specSlots: BlockSpecSlots<BlockService>

Inherited from

RootService.specSlots

Defined in

packages/framework/block-std/dist/extension/service.d.ts:22


std

readonly std: BlockStdScope

Inherited from

RootService.std

Defined in

packages/framework/block-std/dist/extension/service.d.ts:15


TemplateJob

TemplateJob: typeof TemplateJob

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:109


transformers

transformers: object

html

html: object = HtmlTransformer

html.exportDoc()

html.exportDoc: (doc) => Promise<void>

Parameters

doc: Doc

Returns

Promise<void>

markdown

markdown: object = MarkdownTransformer

markdown.exportDoc()

markdown.exportDoc: (doc) => Promise<void>

Parameters

doc: Doc

Returns

Promise<void>

markdown.importMarkdown()

markdown.importMarkdown: (__namedParameters) => Promise<void>

Parameters

__namedParameters: ImportMarkdownOptions

Returns

Promise<void>

zip

zip: object = ZipTransformer

zip.exportDocs()

zip.exportDocs: (collection, docs) => Promise<Blob>

Parameters

collection: DocCollection

docs: Doc[]

Returns

Promise<Blob>

zip.importDocs()

zip.importDocs: (collection, imported) => Promise<(undefined | Doc)[]>

Parameters

collection: DocCollection

imported: Blob

Returns

Promise<(undefined | Doc)[]>

Inherited from

RootService.transformers

Defined in

packages/blocks/src/root-block/root-service.ts:27


flavour

readonly static flavour: "affine:page" = RootBlockSchema.model.flavour

Overrides

RootService.flavour

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:65

Accessors

blocks

get blocks(): EdgelessBlockModel<GfxCompatibleProps>[]

Returns

EdgelessBlockModel<GfxCompatibleProps>[]

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:111


collection

get collection(): DocCollection

Returns

DocCollection

Inherited from

RootService.collection

Defined in

packages/framework/block-std/dist/extension/service.d.ts:23


connectorOverlay

get connectorOverlay(): ConnectionOverlay

Returns

ConnectionOverlay

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:115


doc

get doc(): Doc

Returns

Doc

Inherited from

RootService.doc

Defined in

packages/framework/block-std/dist/extension/service.d.ts:24


edgelessElements

get edgelessElements(): GfxModel[]

sorted edgeless elements

Returns

GfxModel[]

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:122


elements

get elements(): SurfaceElementModel<BaseElementProps>[]

sorted canvas elements

Returns

SurfaceElementModel<BaseElementProps>[]

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:131


frame

get frame(): EdgelessFrameManager

Returns

EdgelessFrameManager

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:135


frameOverlay

get frameOverlay(): FrameOverlay

Returns

FrameOverlay

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:139


frames

get frames(): FrameBlockModel[]

Returns

FrameBlockModel[]

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:143


gfx

get gfx(): GfxController

Returns

GfxController

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:149


host

get host(): EditorHost

Returns

EditorHost

Implementation of

SurfaceContext.host

Overrides

RootService.host

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:153


layer

get layer(): LayerManager

Returns

LayerManager

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:157


locked

get locked(): boolean

set locked(locked): void

Parameters

locked: boolean

Returns

boolean

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:161


selectedBlocks

get selectedBlocks(): BlockComponent<BlockModel<object, SignaledProps<object>>, BlockService, string>[]

Returns

BlockComponent<BlockModel<object, SignaledProps<object>>, BlockService, string>[]

Inherited from

RootService.selectedBlocks

Defined in

packages/blocks/src/root-block/root-service.ts:33


selectedModels

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

Returns

BlockModel<object, SignaledProps<object>>[]

Inherited from

RootService.selectedModels

Defined in

packages/blocks/src/root-block/root-service.ts:51


selection

get selection(): EdgelessSelectionManager

Returns

EdgelessSelectionManager

Implementation of

SurfaceContext.selection

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:169


selectionManager

get selectionManager(): SelectionManager

Returns

SelectionManager

Inherited from

RootService.selectionManager

Defined in

packages/framework/block-std/dist/extension/service.d.ts:26


snap

get snap(): EdgelessSnapManager

Returns

EdgelessSnapManager

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:173


surface

get surface(): SurfaceBlockModel

Returns

SurfaceBlockModel

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:177


tool

get tool(): EdgelessToolsManager

Returns

EdgelessToolsManager

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:181


uiEventDispatcher

get uiEventDispatcher(): UIEventDispatcher

Returns

UIEventDispatcher

Inherited from

RootService.uiEventDispatcher

Defined in

packages/framework/block-std/dist/extension/service.d.ts:27


viewport

get viewport(): Viewport

Returns

Viewport

Implementation of

SurfaceContext.viewport

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:185


viewportElement

get viewportElement(): null | HTMLElement

Returns

null | HTMLElement

Inherited from

RootService.viewportElement

Defined in

packages/blocks/src/root-block/root-service.ts:55


zoom

get zoom(): number

Returns

number

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:189

Methods

addBlock()

addBlock(flavour, props, parent?, parentIndex?): string

Parameters

flavour: string

props: Record<string, unknown>

parent?: string | BlockModel<object, SignaledProps<object>>

parentIndex?: number

Returns

string

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:239


addElement()

addElement<T>(type, props): string

Type Parameters

T extends Record<string, unknown>

Parameters

type: string

props: T

Returns

string

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:257


bindHotKey()

bindHotKey(keymap, options?): void

Parameters

keymap: Record<string, UIEventHandler>

options?

options.global?: boolean

Returns

void

Inherited from

RootService.bindHotKey

Defined in

packages/framework/block-std/dist/extension/service.d.ts:32


createGroup()

createGroup(elements): string

Parameters

elements: GfxModel[] | string[]

Returns

string

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:272


createGroupFromSelected()

createGroupFromSelected(): undefined | string

Returns

undefined | string

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:291


createTemplateJob()

createTemplateJob(type): TemplateJob

Parameters

type: "template" | "sticker"

Returns

TemplateJob

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:328


dispose()

dispose(): void

Returns

void

Inherited from

RootService.dispose

Defined in

packages/framework/block-std/dist/extension/service.d.ts:35


generateIndex()

generateIndex(): string

Returns

string

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:366


getConnectors()

getConnectors(element): ConnectorElementModel[]

Parameters

element: string | GfxModel

Returns

ConnectorElementModel[]

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:370


getElementById()

getElementById(id): null | GfxModel

Parameters

id: string

Returns

null | GfxModel

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:376


getElementsByType()

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

Type Parameters

K extends keyof SurfaceElementModelMap

Parameters

type: K

Returns

SurfaceElementModelMap[K][]

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:383


getFitToScreenData()

getFitToScreenData(padding, inputBounds?): object

Parameters

padding: [number, number, number, number] = ...

inputBounds?: Bound[]

Returns

object

centerX

centerX: number

centerY

centerY: number

zoom

zoom: number

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:389


handleEvent()

handleEvent(name, fn, options?): void

Parameters

name: "pan" | "click" | "blur" | "focus" | "doubleClick" | "tripleClick" | "pointerDown" | "pointerMove" | "pointerUp" | "pointerOut" | "dragStart" | "dragMove" | "dragEnd" | "pinch" | "keyDown" | "keyUp" | "selectionChange" | "compositionStart" | "compositionUpdate" | "compositionEnd" | "cut" | "copy" | "paste" | "beforeInput" | "drop" | "contextMenu" | "wheel"

fn: UIEventHandler

options?

options.global?: boolean

Returns

void

Inherited from

RootService.handleEvent

Defined in

packages/framework/block-std/dist/extension/service.d.ts:36


mounted()

mounted(): void

Returns

void

Overrides

RootService.mounted

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:417


pickElementInGroup()

pickElementInGroup(x, y, options?): null | GfxModel

This method is used to pick element in group, if the picked element is in a group, we will pick the group instead. If that picked group is currently selected, then we will pick the element itself.

Parameters

x: number

y: number

options?: PointTestOptions

Returns

null | GfxModel

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:428


registerTool()

registerTool(Tool): void

Parameters

Tool: EdgelessToolConstructor

Returns

void

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:468


removeElement()

removeElement(id): void

Parameters

id: string | GfxModel

Returns

void

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:472


reorderElement()

reorderElement(element, direction): void

Parameters

element: GfxModel

direction: ReorderingDirection

Returns

void

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:487


setZoomByAction()

setZoomByAction(action): void

Parameters

action: ZoomAction

Returns

void

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:503


setZoomByStep()

setZoomByStep(step): void

Parameters

step: number

Returns

void

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:519


ungroup()

ungroup(group): void

Parameters

group: GroupElementModel

Returns

void

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:523


unmounted()

unmounted(): void

Returns

void

Overrides

RootService.unmounted

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:563


updateElement()

updateElement(id, props): void

Parameters

id: string

props: Record<string, unknown>

Returns

void

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:574


zoomToFit()

zoomToFit(): void

Returns

void

Defined in

packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:597


setup()

static setup(di): void

Parameters

di: Container

Returns

void

Inherited from

RootService.setup

Defined in

packages/framework/block-std/dist/extension/service.d.ts:31