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
flavourProvider
flavour
string
Returns
Overrides
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:186
Properties
disposables
readonly
disposables:DisposableGroup
Inherited from
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:64
fileDropManager
readonly
fileDropManager:FileDropManager
Inherited from
Defined in
packages/blocks/src/root-block/root-service.ts:25
flavour
readonly
flavour:string
Inherited from
Defined in
packages/framework/block-std/dist/extension/service.d.ts:21
flavourProvider
readonly
flavourProvider:object
flavour
flavour:
string
Inherited from
Defined in
packages/framework/block-std/dist/extension/service.d.ts:16
slots
slots:
object
copyAsPng
copyAsPng:
Slot
<{blocks
:EdgelessBlockModelType
[];shapes
:SurfaceModel
[]; }>
cursorUpdated
cursorUpdated:
Slot
<string
>
draggingAreaUpdated
draggingAreaUpdated:
Slot
<void
>
elementResizeEnd
elementResizeEnd:
Slot
<void
>
elementResizeStart
elementResizeStart:
Slot
<void
>
fullScreenToggled
fullScreenToggled:
Slot
<void
>
navigatorFrameChanged
navigatorFrameChanged:
Slot
<FrameBlockModel
>
navigatorSettingUpdated
navigatorSettingUpdated:
Slot
<{blackBackground
:boolean
;fillScreen
:boolean
;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:66
specSlots
readonly
specSlots:BlockSpecSlots
<BlockService
>
Inherited from
Defined in
packages/framework/block-std/dist/extension/service.d.ts:22
std
readonly
std:BlockStdScope
Inherited from
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:90
transformers
transformers:
object
html
html:
object
=HtmlTransformer
html.exportDoc()
html.exportDoc: (
doc
) =>Promise
<void
>
Exports a doc to HTML format.
Parameters
doc
The doc to be exported.
Returns
Promise
<void
>
A Promise that resolves when the export is complete.
html.importHTMLToDoc()
html.importHTMLToDoc: (
options
) =>Promise
<undefined
|string
>
Imports HTML content into a new doc within a collection.
Parameters
options
ImportHTMLToDocOptions
The import options.
Returns
Promise
<undefined
| string
>
A Promise that resolves to the ID of the newly created doc, or undefined if import fails.
html.importHTMLZip()
html.importHTMLZip: (
options
) =>Promise
<string
[]>
Imports a zip file containing HTML files and assets into a collection.
Parameters
options
ImportHTMLZipOptions
The import options.
Returns
Promise
<string
[]>
A Promise that resolves to an array of IDs of the newly created docs.
markdown
markdown:
object
=MarkdownTransformer
markdown.exportDoc()
markdown.exportDoc: (
doc
) =>Promise
<void
>
Exports a doc to a Markdown file or a zip archive containing Markdown and assets.
Parameters
doc
The doc to export
Returns
Promise
<void
>
A Promise that resolves when the export is complete
markdown.importMarkdownToBlock()
markdown.importMarkdownToBlock: (
options
) =>Promise
<void
>
Imports Markdown content into a specific block within a doc.
Parameters
options
ImportMarkdownToBlockOptions
Object containing import options
Returns
Promise
<void
>
A Promise that resolves when the import is complete
markdown.importMarkdownToDoc()
markdown.importMarkdownToDoc: (
options
) =>Promise
<undefined
|string
>
Imports Markdown content into a new doc within a collection.
Parameters
options
ImportMarkdownToDocOptions
Object containing import options
Returns
Promise
<undefined
| string
>
A Promise that resolves to the ID of the newly created doc, or undefined if import fails
markdown.importMarkdownZip()
markdown.importMarkdownZip: (
options
) =>Promise
<string
[]>
Imports a zip file containing Markdown files and assets into a collection.
Parameters
options
ImportMarkdownZipOptions
Object containing import options
Returns
Promise
<string
[]>
A Promise that resolves to an array of IDs of the newly created docs
zip
zip:
object
=ZipTransformer
zip.exportDocs()
zip.exportDocs: (
collection
,docs
) =>Promise
<void
>
Parameters
collection
docs
Doc
[]
Returns
Promise
<void
>
zip.importDocs()
zip.importDocs: (
collection
,imported
) =>Promise
<(undefined
|Doc
)[]>
Parameters
collection
imported
Blob
Returns
Promise
<(undefined
| Doc
)[]>
Inherited from
Defined in
packages/blocks/src/root-block/root-service.ts:27
flavour
readonly
static
flavour:"affine:page"
=RootBlockSchema.model.flavour
Overrides
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:60
Accessors
blocks
Get Signature
get blocks():
EdgelessBlockModel
<GfxCompatibleProps
>[]
Returns
EdgelessBlockModel
<GfxCompatibleProps
>[]
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:115
collection
Get Signature
get collection():
DocCollection
Returns
Inherited from
Defined in
packages/framework/block-std/dist/extension/service.d.ts:23
doc
Get Signature
get doc():
Doc
Returns
Inherited from
Defined in
packages/framework/block-std/dist/extension/service.d.ts:24
edgelessElements
Get Signature
get edgelessElements():
GfxModel
[]
sorted edgeless elements
Returns
GfxModel
[]
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:122
elements
Get Signature
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 Signature
get frame():
EdgelessFrameManager
Returns
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:135
frames
Get Signature
get frames():
FrameBlockModel
[]
Get all sorted frames by presentation orderer, the legacy frame that uses index
as presentation order will be put at the beginning of the array.
Returns
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:146
gfx
Get Signature
get gfx():
GfxController
Returns
GfxController
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:150
host
Get Signature
get host():
EditorHost
Returns
Implementation of
Overrides
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:154
layer
Get Signature
get layer():
LayerManager
Returns
LayerManager
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:158
locked
Get Signature
get locked():
boolean
Returns
boolean
Set Signature
set locked(
locked
):void
Parameters
locked
boolean
Returns
void
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:162
selectedBlocks
Get Signature
get selectedBlocks():
BlockComponent
<BlockModel
<object
,SignaledProps
<object
>>,BlockService
,string
>[]
Returns
BlockComponent
<BlockModel
<object
, SignaledProps
<object
>>, BlockService
, string
>[]
Inherited from
Defined in
packages/blocks/src/root-block/root-service.ts:33
selectedModels
Get Signature
get selectedModels():
BlockModel
<object
,SignaledProps
<object
>>[]
Returns
BlockModel
<object
, SignaledProps
<object
>>[]
Inherited from
Defined in
packages/blocks/src/root-block/root-service.ts:51
selection
Get Signature
get selection():
GfxSelectionManager
Returns
GfxSelectionManager
Implementation of
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:170
selectionManager
Get Signature
get selectionManager():
SelectionManager
Returns
Inherited from
Defined in
packages/framework/block-std/dist/extension/service.d.ts:26
surface
Get Signature
get surface():
SurfaceBlockModel
Returns
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:174
uiEventDispatcher
Get Signature
get uiEventDispatcher():
UIEventDispatcher
Returns
Inherited from
Defined in
packages/framework/block-std/dist/extension/service.d.ts:27
viewport
Get Signature
get viewport():
Viewport
Returns
Viewport
Implementation of
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:178
viewportElement
Get Signature
get viewportElement():
null
|HTMLElement
Returns
null
| HTMLElement
Inherited from
Defined in
packages/blocks/src/root-block/root-service.ts:55
zoom
Get Signature
get zoom():
number
Returns
number
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:182
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:223
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:241
bindHotKey()
bindHotKey(
keymap
,options
?):void
Parameters
keymap
Record
<string
, UIEventHandler
>
options?
global
boolean
Returns
void
Inherited from
Defined in
packages/framework/block-std/dist/extension/service.d.ts:32
createGroup()
createGroup(
elements
):string
Parameters
elements
string
[] | GfxModel
[]
Returns
string
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:256
createGroupFromSelected()
createGroupFromSelected():
undefined
|string
Create a group from selected elements, if the selected elements are in the same group
Returns
undefined
| string
the id of the created group
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:279
createTemplateJob()
createTemplateJob(
type
):TemplateJob
Parameters
type
"template"
| "sticker"
Returns
TemplateJob
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:317
dispose()
dispose():
void
Returns
void
Inherited from
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:355
getConnectors()
getConnectors(
element
):ConnectorElementModel
[]
Parameters
element
string
| GfxModel
Returns
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:359
getElementById()
getElementById(
id
):null
|GfxModel
Parameters
id
string
Returns
null
| GfxModel
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:365
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:372
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:378
handleEvent()
handleEvent(
name
,fn
,options
?):void
Parameters
name
"click"
| "doubleClick"
| "tripleClick"
| "pointerDown"
| "pointerMove"
| "pointerUp"
| "pointerOut"
| "dragStart"
| "dragMove"
| "dragEnd"
| "pinch"
| "pan"
| "keyDown"
| "keyUp"
| "selectionChange"
| "compositionStart"
| "compositionUpdate"
| "compositionEnd"
| "cut"
| "copy"
| "paste"
| "nativeDragStart"
| "nativeDragMove"
| "nativeDragEnd"
| "nativeDrop"
| "beforeInput"
| "blur"
| "focus"
| "contextMenu"
| "wheel"
fn
options?
global
boolean
Returns
void
Inherited from
Defined in
packages/framework/block-std/dist/extension/service.d.ts:36
mounted()
mounted():
void
Returns
void
Overrides
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:406
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:417
removeElement()
removeElement(
id
):void
Parameters
id
string
| GfxModel
Returns
void
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:425
reorderElement()
reorderElement(
element
,direction
):void
Parameters
element
GfxModel
direction
ReorderingDirection
Returns
void
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:446
setZoomByAction()
setZoomByAction(
action
):void
Parameters
action
ZoomAction
Returns
void
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:462
setZoomByStep()
setZoomByStep(
step
):void
Parameters
step
number
Returns
void
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:478
ungroup()
ungroup(
group
):void
Parameters
group
Returns
void
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:482
unmounted()
unmounted():
void
Returns
void
Overrides
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:522
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:92
zoomToFit()
zoomToFit():
void
Returns
void
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-service.ts:530
setup()
static
setup(di
):void
Parameters
di
Container
Returns
void
Inherited from
Defined in
packages/framework/block-std/dist/extension/service.d.ts:31