BlockSuite API Documentation / @blocksuite/blocks / EdgelessRootService
Class: EdgelessRootService
Extends
Constructors
new EdgelessRootService(options)
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:56
_frame
private
_frame:EdgelessFrameManager
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:90
_layer
private
_layer:LayerManager
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:89
_selection
private
_selection:EdgelessSelectionManager
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:92
_snap
private
_snap:EdgelessSnapManager
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:91
_surface
private
_surface:SurfaceBlockModel
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:88
_tool
private
_tool:EdgelessToolsManager
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:94
_viewport
private
_viewport:Viewport
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:93
copilot
readonly
copilot:Copilot
Inherited from
Source
packages/blocks/src/root-block/root-service.ts:53
disposables
readonly
disposables:DisposableGroup
Inherited from
Source
packages/framework/block-std/dist/service/index.d.ts:14
editSession
readonly
editSession:EditSessionStorage
Inherited from
Source
packages/blocks/src/root-block/root-service.ts:52
exportManager
exportManager:
ExportManager
Inherited from
Source
packages/blocks/src/root-block/root-service.ts:56
fileDropManager
fileDropManager:
FileDropManager
Inherited from
Source
packages/blocks/src/root-block/root-service.ts:55
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:51
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
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
>
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:58
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
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:58
Accessors
blocks
get
blocks():EdgelessBlock
<EdgelessSelectableProps
>[]
Returns
EdgelessBlock
<EdgelessSelectableProps
>[]
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:178
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(): (ElementModel
<BaseProps
> |EdgelessBlock
<EdgelessSelectableProps
>)[]
sorted edgeless elements
Returns
(ElementModel
<BaseProps
> | EdgelessBlock
<EdgelessSelectableProps
>)[]
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:166
elements
get
elements():ElementModel
<BaseProps
>[]
sorted canvas elements
Returns
ElementModel
<BaseProps
>[]
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:159
frame
get
frame():EdgelessFrameManager
Returns
EdgelessFrameManager
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:148
frames
get
frames():FrameBlockModel
[]
Returns
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:174
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:95
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:85
host
get
host():EditorHost
Returns
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:186
layer
get
layer():LayerManager
Returns
LayerManager
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:136
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:166
selectedModels
get
selectedModels():BlockModel
<object
>[]
Returns
BlockModel
<object
>[]
Source
packages/blocks/src/root-block/root-service.ts:184
selection
get
selection():EdgelessSelectionManager
Returns
EdgelessSelectionManager
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:140
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:152
surface
get
surface():SurfaceBlockModel
Returns
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:132
tool
get
tool():EdgelessToolsManager
Returns
EdgelessToolsManager
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:128
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:144
viewportElement
get
viewportElement():HTMLElement
Returns
HTMLElement
Source
packages/blocks/src/root-block/root-service.ts:72
zoom
get
zoom():number
Returns
number
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:182
Methods
_initReadonlyListener()
private
_initReadonlyListener():void
Returns
void
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:206
_initSlotEffects()
private
_initSlotEffects():void
Returns
void
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:190
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:239
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:225
appendParagraph()
appendParagraph(
text
):void
Parameters
• text: string
= ''
Returns
void
Inherited from
Source
packages/blocks/src/root-block/root-service.ts:210
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
[] | EdgelessModel
[]
Returns
string
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:463
createGroupFromSelected()
createGroupFromSelected():
undefined
|string
Returns
undefined
| string
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:483
createTemplateJob()
createTemplateJob(
type
):TemplateJob
Parameters
• type: "template"
| "sticker"
Returns
TemplateJob
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:559
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:220
getConnectors()
getConnectors(
element
):ConnectorElementModel
[]
Parameters
• element: string
| EdgelessModel
Returns
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:553
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:287
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:252
getEmbedBlockOptions()
getEmbedBlockOptions(
url
):null
|EmbedOptions
Parameters
• url: string
Returns
null
| EmbedOptions
Inherited from
RootService
.getEmbedBlockOptions
Source
packages/blocks/src/root-block/root-service.ts:109
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:608
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
loadFonts()
loadFonts():
void
Returns
void
Inherited from
Source
packages/blocks/src/root-block/root-service.ts:188
mounted()
mounted():
void
Returns
void
Overrides
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:96
pickElement()
pickElement(x, y, options)
pickElement(
x
,y
,options
):EdgelessModel
[]
Parameters
• x: number
• y: number
• options
• options.all: true
Returns
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:294
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:295
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:411
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
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:359
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:360
registerEmbedBlockOptions()
registerEmbedBlockOptions(
options
):void
Parameters
• options: EmbedOptions
Returns
void
Inherited from
RootService
.registerEmbedBlockOptions
Source
packages/blocks/src/root-block/root-service.ts:105
registerTool()
registerTool(
Tool
):void
Parameters
• Tool: EdgelessToolConstructor
Returns
void
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:549
removeElement()
removeElement(
id
):void
Parameters
• id: string
| EdgelessModel
Returns
void
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:273
reorderElement()
reorderElement(
element
,direction
):void
Parameters
• element: EdgelessModel
• direction: ReorderingDirection
Returns
void
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:450
setZoomByAction()
setZoomByAction(
action
):void
Parameters
• action: ZoomAction
Returns
void
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:643
setZoomByStep()
setZoomByStep(
step
):void
Parameters
• step: number
Returns
void
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:599
ungroup()
ungroup(
group
):void
Parameters
• group: GroupElementModel
Returns
void
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:517
unmounted()
unmounted():
void
Returns
void
Overrides
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:118
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:258
zoomToFit()
zoomToFit():
void
Returns
void
Source
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:603