BlockSuite API Documentation / @blocksuite/blocks / EdgelessRootService
Class: EdgelessRootService
Extends
Constructors
new EdgelessRootService()
new EdgelessRootService(
options
):EdgelessRootService
Parameters
• options: BlockServiceOptions
Returns
Inherited from
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:165
_frame
private
_frame:EdgelessFrameManager
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:155
_layer
private
_layer:LayerManager
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:153
_selection
private
_selection:EdgelessSelectionManager
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:159
_snap
private
_snap:EdgelessSnapManager
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:157
_surface
private
_surface:SurfaceBlockModel
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:151
_tool
private
_tool:EdgelessToolsManager
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:163
_viewport
private
_viewport:Viewport
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:161
disposables
readonly
disposables:DisposableGroup
Inherited from
Source
packages/framework/block-std/dist/service/index.d.ts:14
docModeService
docModeService:
DocModeService
Inherited from
Source
packages/blocks/src/root-block/root-service.ts:176
editPropsStore
readonly
editPropsStore:EditPropsStore
Inherited from
Source
packages/blocks/src/root-block/root-service.ts:165
exportManager
exportManager:
ExportManager
Inherited from
Source
packages/blocks/src/root-block/root-service.ts:169
fileDropManager
fileDropManager:
FileDropManager
Inherited from
Source
packages/blocks/src/root-block/root-service.ts:167
flavour
readonly
flavour:string
Inherited from
Source
packages/framework/block-std/dist/service/index.d.ts:13
fontLoader
readonly
fontLoader:FontLoader
Inherited from
Source
packages/blocks/src/root-block/root-service.ts:163
notificationService
notificationService:
null
|NotificationService
=null
Inherited from
RootService
.notificationService
Source
packages/blocks/src/root-block/root-service.ts:172
peekViewService
peekViewService:
null
|PeekViewService
=null
Inherited from
Source
packages/blocks/src/root-block/root-service.ts:174
quickSearchService
quickSearchService:
null
|QuickSearchService
=null
Inherited from
RootService
.quickSearchService
Source
packages/blocks/src/root-block/root-service.ts:178
slots
slots:
object
copyAsPng
copyAsPng:
Slot
<object
>
Type declaration
blocks
blocks:
EdgelessBlockModelType
[]
shapes
shapes:
SurfaceModelType
[]
cursorUpdated
cursorUpdated:
Slot
<string
>
docLinkClicked
docLinkClicked:
Slot
<object
>
Type declaration
blockId?
optional
blockId:string
docId
docId:
string
draggingAreaUpdated
draggingAreaUpdated:
Slot
<void
>
edgelessToolUpdated
edgelessToolUpdated:
Slot
<NoteTool
|TextTool
|BrushTool
|ShapeTool
|ConnectorTool
|MindmapTool
|FrameTool
|CopilotSelectionTool
|DefaultTool
|EraserTool
|FrameNavigatorTool
|LassoTool
|PanTool
|object
>
elementResizeEnd
elementResizeEnd:
Slot
<void
>
elementResizeStart
elementResizeStart:
Slot
<void
>
fullScreenToggled
fullScreenToggled:
Slot
<void
>
navigatorFrameChanged
navigatorFrameChanged:
Slot
<FrameBlockModel
>
navigatorSettingUpdated
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:167
specSlots
readonly
specSlots:BlockSpecSlots
Inherited from
Source
packages/framework/block-std/dist/service/index.d.ts:15
std
readonly
std:BlockStdScope
Inherited from
Source
packages/framework/block-std/dist/service/index.d.ts:12
telemetryService
telemetryService:
null
|TelemetryService
=null
Inherited from
Source
packages/blocks/src/root-block/root-service.ts:180
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
Source
packages/blocks/src/root-block/root-service.ts:182
Accessors
blocks
get
blocks():EdgelessBlockModel
<EdgelessSelectableProps
>[]
Returns
EdgelessBlockModel
<EdgelessSelectableProps
>[]
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:131
collection
get
collection():DocCollection
Returns
Source
packages/framework/block-std/dist/service/index.d.ts:17
doc
get
doc():Doc
Returns
Source
packages/framework/block-std/dist/service/index.d.ts:18
edgelessElements
get
edgelessElements(): (SurfaceElementModel
<IBaseProps
> |EdgelessBlockModel
<EdgelessSelectableProps
>)[]
sorted edgeless elements
Returns
(SurfaceElementModel
<IBaseProps
> | EdgelessBlockModel
<EdgelessSelectableProps
>)[]
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:119
elements
get
elements():SurfaceElementModel
<IBaseProps
>[]
sorted canvas elements
Returns
SurfaceElementModel
<IBaseProps
>[]
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:112
frame
get
frame():EdgelessFrameManager
Returns
EdgelessFrameManager
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:101
frames
get
frames():FrameBlockModel
[]
Returns
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:127
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:123
host
get
host():EditorHost
Returns
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:147
layer
get
layer():LayerManager
Returns
LayerManager
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:89
locked
get
locked():boolean
set
locked(locked
):void
Parameters
• locked: boolean
Returns
boolean
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:139
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:131
selectedModels
get
selectedModels():BlockModel
<object
>[]
Returns
BlockModel
<object
>[]
Source
packages/blocks/src/root-block/root-service.ts:149
selection
get
selection():EdgelessSelectionManager
Returns
EdgelessSelectionManager
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:93
selectionManager
get
selectionManager():SelectionManager
Returns
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:105
surface
get
surface():SurfaceBlockModel
Returns
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:85
tool
get
tool():EdgelessToolsManager
Returns
EdgelessToolsManager
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:81
uiEventDispatcher
get
uiEventDispatcher():UIEventDispatcher
Returns
Source
packages/framework/block-std/dist/service/index.d.ts:21
viewport
get
viewport():Viewport
Returns
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:97
viewportElement
get
viewportElement():HTMLElement
Returns
HTMLElement
Source
packages/blocks/src/root-block/root-service.ts:113
zoom
get
zoom():number
Returns
number
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:135
Methods
_initReadonlyListener()
private
_initReadonlyListener():void
Returns
void
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:213
_initSlotEffects()
private
_initSlotEffects():void
Returns
void
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:197
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:280
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:266
appendParagraph()
appendParagraph(
text
):void
Parameters
• text: string
= ''
Returns
void
Inherited from
Source
packages/blocks/src/root-block/root-service.ts:395
bindHotKey()
bindHotKey(
keymap
,options
?):void
Parameters
• keymap: Record
<string
, UIEventHandler
>
• options?
• options.global?: boolean
Returns
void
Inherited from
Source
packages/framework/block-std/dist/service/index.d.ts:28
createGroup()
createGroup(
elements
):string
Parameters
• elements: string
[] | EdgelessModelType
[]
Returns
string
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:531
createGroupFromSelected()
createGroupFromSelected():
undefined
|string
Returns
undefined
| string
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:551
createTemplateJob()
createTemplateJob(
type
):TemplateJob
Parameters
• type: "template"
| "sticker"
Returns
TemplateJob
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:636
dispose()
dispose():
void
Returns
void
Inherited from
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:261
getConnectors()
getConnectors(
element
):ConnectorElementModel
[]
Parameters
• element: string
| EdgelessModelType
Returns
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:630
getElementById()
getElementById(
id
):null
|EdgelessModelType
Parameters
• id: string
Returns
null
| EdgelessModelType
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:338
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:296
getEmbedBlockOptions()
getEmbedBlockOptions(
url
):null
|EmbedOptions
Parameters
• url: string
Returns
null
| EmbedOptions
Inherited from
RootService
.getEmbedBlockOptions
Source
packages/blocks/src/root-block/root-service.ts:331
getFitToScreenData()
getFitToScreenData(
padding
,inputBounds
?):object
Parameters
• padding: [number
, number
, number
, number
]= undefined
• inputBounds?: Bound
[]
Returns
object
centerX
centerX:
number
centerY
centerY:
number
zoom
zoom:
number
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:685
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
Source
packages/framework/block-std/dist/service/index.d.ts:25
insertLinkByQuickSearch()
insertLinkByQuickSearch(
userInput
?,skipSelection
?):Promise
<undefined
|object
>
Parameters
• userInput?: string
• skipSelection?: boolean
Returns
Promise
<undefined
| object
>
Inherited from
RootService
.insertLinkByQuickSearch
Source
packages/blocks/src/root-block/root-service.ts:415
loadFonts()
loadFonts():
void
Returns
void
Inherited from
Source
packages/blocks/src/root-block/root-service.ts:391
mounted()
mounted():
void
Returns
void
Overrides
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:227
pickElement()
pickElement(x, y, options)
pickElement(
x
,y
,options
):EdgelessModelType
[]
Parameters
• x: number
• y: number
• options
• options.all: true
• options.expand?: number
Returns
EdgelessModelType
[]
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:345
pickElement(x, y, options)
pickElement(
x
,y
,options
?):null
|EdgelessModelType
Parameters
• x: number
• y: number
• options?
• options.all?: false
• options.expand?: number
Returns
null
| EdgelessModelType
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:350
pickElementInGroup()
pickElementInGroup(
x
,y
,options
?):null
|EdgelessModelType
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?: IHitTestOptions
Returns
null
| EdgelessModelType
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:475
pickElementsByBound()
pickElementsByBound(bound, type)
pickElementsByBound(
bound
,type
?):EdgelessModelType
[]
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
EdgelessModelType
[]
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:416
pickElementsByBound(bound, type)
pickElementsByBound(
bound
,type
):EdgelessBlockModel
<EdgelessSelectableProps
>[]
Parameters
• bound: IBound
| Bound
• type: "frame"
| "blocks"
Returns
EdgelessBlockModel
<EdgelessSelectableProps
>[]
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:420
pickElementsByBound(bound, type)
pickElementsByBound(
bound
,type
):SurfaceElementModelType
[]
Parameters
• bound: IBound
| Bound
• type: "canvas"
Returns
SurfaceElementModelType
[]
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:424
registerEmbedBlockOptions()
registerEmbedBlockOptions(
options
):void
Parameters
• options: EmbedOptions
Returns
void
Inherited from
RootService
.registerEmbedBlockOptions
Source
packages/blocks/src/root-block/root-service.ts:327
registerTool()
registerTool(
Tool
):void
Parameters
• Tool: EdgelessToolConstructor
Returns
void
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:626
removeElement()
removeElement(
id
):void
Parameters
• id: string
| EdgelessModelType
Returns
void
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:323
reorderElement()
reorderElement(
element
,direction
):void
Parameters
• element: EdgelessModelType
• direction: ReorderingDirection
Returns
void
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:515
setZoomByAction()
setZoomByAction(
action
):void
Parameters
• action: ZoomAction
Returns
void
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:726
setZoomByStep()
setZoomByStep(
step
):void
Parameters
• step: number
Returns
void
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:676
ungroup()
ungroup(
group
):void
Parameters
• group: GroupElementModel
Returns
void
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:588
unmounted()
unmounted():
void
Returns
void
Overrides
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:249
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:302
zoomToFit()
zoomToFit():
void
Returns
void
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:680