Skip to content

BlockSuite API Documentation / @blocksuite/blocks / EdgelessRootService

Class: EdgelessRootService

Extends

Constructors

new EdgelessRootService(options)

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 = TemplateJob

Source

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


_frame

private _frame: EdgelessFrameManager

Source

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


_layer

private _layer: LayerManager

Source

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


_selection

private _selection: EdgelessSelectionManager

Source

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


_snap

private _snap: EdgelessSnapManager

Source

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


_surface

private _surface: SurfaceBlockModel

Source

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


_tool

private _tool: EdgelessToolsManager

Source

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


_viewport

private _viewport: Viewport

Source

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


disposables

readonly disposables: DisposableGroup

Inherited from

RootService.disposables

Source

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


editSession

readonly editSession: EditSessionStorage

Inherited from

RootService.editSession

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

slots.copyAsPng

copyAsPng: Slot<Object>

Type declaration
blocks

blocks: TopLevelBlockModel[]

shapes

shapes: CanvasElement[]

slots.cursorUpdated

cursorUpdated: Slot<string>

slots.docLinkClicked

docLinkClicked: Slot<Object>

Type declaration
blockId?

optional blockId: string

docId

docId: string

slots.draggingAreaUpdated

draggingAreaUpdated: Slot<void>

slots.edgelessToolUpdated

edgelessToolUpdated: Slot<EdgelessTool>

slots.editorModeSwitch

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

slots.elementResizeEnd

elementResizeEnd: Slot<void>

slots.elementResizeStart

elementResizeStart: Slot<void>

slots.fullScreenToggled

fullScreenToggled: Slot<void>

slots.navigatorFrameChanged

navigatorFrameChanged: Slot<FrameBlockModel>

slots.navigatorSettingUpdated

navigatorSettingUpdated: Slot<Object>

Type declaration
blackBackground?

optional blackBackground: boolean

fillScreen?

optional fillScreen: boolean

hideToolbar?

optional hideToolbar: boolean

slots.pressShiftKeyUpdated

pressShiftKeyUpdated: Slot<boolean>

slots.readonlyUpdated

readonlyUpdated: Slot<boolean>

slots.tagClicked

tagClicked: Slot<Object>

Type declaration
tagId

tagId: string

slots.toggleNoteSlicer

toggleNoteSlicer: Slot<void>

Source

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


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

transformers.html

html: Object = HtmlTransformer

transformers.html.exportDoc

exportDoc: (doc) => Promise<void>

Parameters

doc: Doc

Returns

Promise<void>

transformers.markdown

markdown: Object = MarkdownTransformer

transformers.markdown.exportDoc

exportDoc: (doc) => Promise<void>

Parameters

doc: Doc

Returns

Promise<void>

transformers.markdown.importMarkdown

importMarkdown: (__namedParameters) => Promise<void>

Parameters

__namedParameters: ImportMarkdownOptions

Returns

Promise<void>

transformers.zip

zip: Object = ZipTransformer

transformers.zip.exportDocs

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

Parameters

collection: DocCollection

docs: Doc[]

Returns

Promise<Blob>

transformers.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:177


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:165


elements

get elements(): ElementModel<BaseProps>[]

sorted canvas elements

Returns

ElementModel<BaseProps>[]

Source

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


frame

get frame(): EdgelessFrameManager

Returns

EdgelessFrameManager

Source

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


frames

get frames(): FrameBlockModel[]

Returns

FrameBlockModel[]

Source

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


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) => "edgeless" | "page"

set getEditorMode(value): void

Parameters

value

Returns

Function

Parameters

docId: string

Returns

"edgeless" | "page"

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:185


layer

get layer(): LayerManager

Returns

LayerManager

Source

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


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:164


selectedModels

get selectedModels(): BlockModel<object>[]

Returns

BlockModel<object>[]

Source

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


selection

get selection(): EdgelessSelectionManager

Returns

EdgelessSelectionManager

Source

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


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:151


surface

get surface(): SurfaceBlockModel

Returns

SurfaceBlockModel

Source

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


tool

get tool(): EdgelessToolsManager

Returns

EdgelessToolsManager

Source

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


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:143


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:181

Methods

_initReadonlyListener()

private _initReadonlyListener(): void

Returns

void

Source

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


_initSlotEffects()

private _initSlotEffects(): void

Returns

void

Source

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


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:238


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:224


appendParagraph()

appendParagraph(): void

Returns

void

Inherited from

RootService.appendParagraph

Source

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


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:452


createGroupFromSelected()

createGroupFromSelected(): undefined | string

Returns

undefined | string

Source

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


createTemplateJob()

createTemplateJob(type): TemplateJob

Parameters

type: "template" | "sticker"

Returns

TemplateJob

Source

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


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:219


getConnectors()

getConnectors(element): ConnectorElementModel[]

Parameters

element: string | EdgelessModel

Returns

ConnectorElementModel[]

Source

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


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:282


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:251


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:597


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:186


mounted()

mounted(): void

Returns

void

Overrides

RootService.mounted

Source

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


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:289

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:290


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:401


pickElementsByBound()

pickElementsByBound(bound, type)

pickElementsByBound(bound, type?): EdgelessModel[]

Parameters

bound: IBound | Bound

type?: "all"

Returns

EdgelessModel[]

Source

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

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:350


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:538


removeElement()

removeElement(id): void

Parameters

id: string | EdgelessModel

Returns

void

Source

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


reorderElement()

reorderElement(element, direction): void

Parameters

element: EdgelessModel

direction: ReorderingDirection

Returns

void

Source

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


setZoomByAction()

setZoomByAction(action): void

Parameters

action: ZoomAction

Returns

void

Source

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


setZoomByStep()

setZoomByStep(step): void

Parameters

step: number

Returns

void

Source

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


ungroup()

ungroup(group): void

Parameters

group: GroupElementModel

Returns

void

Source

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


unmounted()

unmounted(): void

Returns

void

Overrides

RootService.unmounted

Source

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


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:257


zoomToFit()

zoomToFit(): void

Returns

void

Source

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