Skip to content

BlockSuite API Documentation / @blocksuite/blocks / EdgelessRootService

Class: EdgelessRootService

Extends

Constructors

new EdgelessRootService()

new EdgelessRootService(options): EdgelessRootService

Parameters

options: BlockServiceOptions

Returns

EdgelessRootService

Inherited from

RootService.constructor

Source

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

Properties

TemplateJob

TemplateJob: typeof TemplateJob

Source

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


_frame

private _frame: EdgelessFrameManager

Source

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


_layer

private _layer: LayerManager

Source

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


_selection

private _selection: EdgelessSelectionManager

Source

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


_snap

private _snap: EdgelessSnapManager

Source

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


_surface

private _surface: SurfaceBlockModel

Source

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


_tool

private _tool: EdgelessToolsManager

Source

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


_viewport

private _viewport: Viewport

Source

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


disposables

readonly disposables: DisposableGroup

Inherited from

RootService.disposables

Source

packages/framework/block-std/dist/service/index.d.ts:14


editPropsStore

readonly editPropsStore: EditPropsStore

Inherited from

RootService.editPropsStore

Source

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


exportManager

exportManager: ExportManager

Inherited from

RootService.exportManager

Source

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


fileDropManager

fileDropManager: FileDropManager

Inherited from

RootService.fileDropManager

Source

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


flavour

readonly flavour: string

Inherited from

RootService.flavour

Source

packages/framework/block-std/dist/service/index.d.ts:13


fontLoader

readonly fontLoader: FontLoader

Inherited from

RootService.fontLoader

Source

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


slots

slots: object

copyAsPng

copyAsPng: Slot<object>

Type declaration
blocks

blocks: TopLevelBlockModel[]

shapes

shapes: CanvasElement[]

cursorUpdated

cursorUpdated: Slot<string>

docLinkClicked

docLinkClicked: Slot<object>

Type declaration
blockId?

optional blockId: string

docId

docId: string

draggingAreaUpdated

draggingAreaUpdated: Slot<void>

edgelessToolUpdated

edgelessToolUpdated: Slot<EdgelessTool>

editorModeSwitch

editorModeSwitch: Slot<"page" | "edgeless">

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>

tagClicked

tagClicked: Slot<object>

Type declaration
tagId

tagId: string

toggleNoteSlicer

toggleNoteSlicer: Slot<void>

toolbarLocked

toolbarLocked: Slot<boolean>

Source

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


specSlots

readonly specSlots: BlockSpecSlots

Inherited from

RootService.specSlots

Source

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


std

readonly std: BlockStdScope

Inherited from

RootService.std

Source

packages/framework/block-std/dist/service/index.d.ts:12


transformers

transformers: object

html

html: object = HtmlTransformer

html.exportDoc()

exportDoc: (doc) => Promise<void>

Parameters

doc: Doc

Returns

Promise<void>

markdown

markdown: object = MarkdownTransformer

markdown.exportDoc()

exportDoc: (doc) => Promise<void>

Parameters

doc: Doc

Returns

Promise<void>

markdown.importMarkdown()

importMarkdown: (__namedParameters) => Promise<void>

Parameters

__namedParameters: ImportMarkdownOptions

Returns

Promise<void>

zip

zip: object = ZipTransformer

zip.exportDocs()

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

Parameters

collection: DocCollection

docs: Doc[]

Returns

Promise<Blob>

zip.importDocs()

importDocs: (collection, imported) => Promise<Doc[]>

Parameters

collection: DocCollection

imported: Blob

Returns

Promise<Doc[]>

Inherited from

RootService.transformers

Source

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

Accessors

blocks

get blocks(): EdgelessBlock<EdgelessSelectableProps>[]

Returns

EdgelessBlock<EdgelessSelectableProps>[]

Source

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


collection

get collection(): DocCollection

Returns

DocCollection

Source

packages/framework/block-std/dist/service/index.d.ts:17


doc

get doc(): Doc

Returns

Doc

Source

packages/framework/block-std/dist/service/index.d.ts:18


edgelessElements

get edgelessElements(): (ElementModel<BaseProps> | EdgelessBlock<EdgelessSelectableProps>)[]

sorted edgeless elements

Returns

(ElementModel<BaseProps> | EdgelessBlock<EdgelessSelectableProps>)[]

Source

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


elements

get elements(): ElementModel<BaseProps>[]

sorted canvas elements

Returns

ElementModel<BaseProps>[]

Source

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


frame

get frame(): EdgelessFrameManager

Returns

EdgelessFrameManager

Source

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


frames

get frames(): FrameBlockModel[]

Returns

FrameBlockModel[]

Source

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


getDocUpdatedAt

get getDocUpdatedAt(): (docId) => Date

set getDocUpdatedAt(value): void

Parameters

value

Returns

Function

Parameters

docId: string

Returns

Date

Source

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


getEditorMode

get getEditorMode(): (docId) => "page" | "edgeless"

set getEditorMode(value): void

Parameters

value

Returns

Function

Parameters

docId: string

Returns

"page" | "edgeless"

Source

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


host

get host(): EditorHost

Returns

EditorHost

Source

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


layer

get layer(): LayerManager

Returns

LayerManager

Source

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


locked

get locked(): boolean

set locked(locked): void

Parameters

locked: boolean

Returns

boolean

Source

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


selectedBlocks

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

Returns

BlockElement<BlockModel<object>, BlockService<BlockModel<object>>, string>[]

Source

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


selectedModels

get selectedModels(): BlockModel<object>[]

Returns

BlockModel<object>[]

Source

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


selection

get selection(): EdgelessSelectionManager

Returns

EdgelessSelectionManager

Source

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


selectionManager

get selectionManager(): SelectionManager

Returns

SelectionManager

Source

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


snap

get snap(): EdgelessSnapManager

Returns

EdgelessSnapManager

Source

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


surface

get surface(): SurfaceBlockModel

Returns

SurfaceBlockModel

Source

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


tool

get tool(): EdgelessToolsManager

Returns

EdgelessToolsManager

Source

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


uiEventDispatcher

get uiEventDispatcher(): UIEventDispatcher

Returns

UIEventDispatcher

Source

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


viewport

get viewport(): Viewport

Returns

Viewport

Source

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


viewportElement

get viewportElement(): HTMLElement

Returns

HTMLElement

Source

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


zoom

get zoom(): number

Returns

number

Source

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

Methods

_initReadonlyListener()

private _initReadonlyListener(): void

Returns

void

Source

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


_initSlotEffects()

private _initSlotEffects(): void

Returns

void

Source

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


addBlock()

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

Parameters

flavour: string

props: Record<string, unknown>

parent?: string | BlockModel<object>

parentIndex?: number

Returns

string

Source

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


addElement()

addElement<T>(type, props): string

Type parameters

T = Record<string, unknown>

Parameters

type: string

props: T

Returns

string

Source

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


appendParagraph()

appendParagraph(text): void

Parameters

text: string= ''

Returns

void

Inherited from

RootService.appendParagraph

Source

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


bindHotKey()

bindHotKey(keymap, options?): void

Parameters

keymap: Record<string, UIEventHandler>

options?

options.global?: boolean

Returns

void

Inherited from

RootService.bindHotKey

Source

packages/framework/block-std/dist/service/index.d.ts:28


createGroup()

createGroup(elements): string

Parameters

elements: string[] | EdgelessModel[]

Returns

string

Source

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


createGroupFromSelected()

createGroupFromSelected(): undefined | string

Returns

undefined | string

Source

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


createTemplateJob()

createTemplateJob(type): TemplateJob

Parameters

type: "template" | "sticker"

Returns

TemplateJob

Source

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


dispose()

dispose(): void

Returns

void

Inherited from

RootService.dispose

Source

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


generateIndex()

generateIndex(type): string

Parameters

type: string

Returns

string

Source

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


getConnectors()

getConnectors(element): ConnectorElementModel[]

Parameters

element: string | EdgelessModel

Returns

ConnectorElementModel[]

Source

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


getElementById()

getElementById(id): ElementModel<BaseProps> | EdgelessBlock<EdgelessSelectableProps>

Parameters

id: string

Returns

ElementModel<BaseProps> | EdgelessBlock<EdgelessSelectableProps>

Source

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


getElementsByType()

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

Type parameters

K extends keyof ElementModelMap

Parameters

type: K

Returns

ElementModelMap[K][]

Source

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


getEmbedBlockOptions()

getEmbedBlockOptions(url): null | EmbedOptions

Parameters

url: string

Returns

null | EmbedOptions

Inherited from

RootService.getEmbedBlockOptions

Source

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


getFitToScreenData()

getFitToScreenData(padding): object

Parameters

padding: [number, number, number, number]= undefined

Returns

object

centerX

centerX: number

centerY

centerY: number

zoom

zoom: number

Source

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


handleEvent()

handleEvent(name, fn, options?): void

Parameters

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

fn: UIEventHandler

options?

options.global?: boolean

Returns

void

Inherited from

RootService.handleEvent

Source

packages/framework/block-std/dist/service/index.d.ts:25


loadFonts()

loadFonts(): void

Returns

void

Inherited from

RootService.loadFonts

Source

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


mounted()

mounted(): void

Returns

void

Overrides

RootService.mounted

Source

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


pickElement()

pickElement(x, y, options)

pickElement(x, y, options): EdgelessModel[]

Parameters

x: number

y: number

options

options.all: true

Returns

EdgelessModel[]

Source

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

pickElement(x, y, options)

pickElement(x, y, options?): null | EdgelessModel

Parameters

x: number

y: number

options?

options.all?: false

Returns

null | EdgelessModel

Source

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


pickElementInGroup()

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

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?: HitTestOptions

Returns

null | EdgelessModel

Source

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


pickElementsByBound()

pickElementsByBound(bound, type)

pickElementsByBound(bound, type?): EdgelessModel[]

Pick the elements in the given area

Parameters

bound: IBound | Bound

type?: "all"

By default, it will pick all elements, but you can specify the type to pick only you need.

Returns

EdgelessModel[]

Source

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

pickElementsByBound(bound, type)

pickElementsByBound(bound, type): EdgelessBlock<EdgelessSelectableProps>[]

Parameters

bound: IBound | Bound

type: "blocks"

Returns

EdgelessBlock<EdgelessSelectableProps>[]

Source

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


registerEmbedBlockOptions()

registerEmbedBlockOptions(options): void

Parameters

options: EmbedOptions

Returns

void

Inherited from

RootService.registerEmbedBlockOptions

Source

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


registerTool()

registerTool(Tool): void

Parameters

Tool: EdgelessToolConstructor

Returns

void

Source

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


removeElement()

removeElement(id): void

Parameters

id: string | EdgelessModel

Returns

void

Source

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


reorderElement()

reorderElement(element, direction): void

Parameters

element: EdgelessModel

direction: ReorderingDirection

Returns

void

Source

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


setZoomByAction()

setZoomByAction(action): void

Parameters

action: ZoomAction

Returns

void

Source

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


setZoomByStep()

setZoomByStep(step): void

Parameters

step: number

Returns

void

Source

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


ungroup()

ungroup(group): void

Parameters

group: GroupElementModel

Returns

void

Source

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


unmounted()

unmounted(): void

Returns

void

Overrides

RootService.unmounted

Source

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


updateElement()

updateElement(id, props): void

Parameters

id: string

props: Record<string, unknown>

Returns

void

Source

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


zoomToFit()

zoomToFit(): void

Returns

void

Source

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