BlockSuite API Documentation / @blocksuite/blocks / PageRootService
Class: PageRootService
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
Constructors
new PageRootService()
new PageRootService(
std
,flavourProvider
):PageRootService
Parameters
• std: BlockStdScope
• flavourProvider
• flavourProvider.flavour: string
Returns
Inherited from
Defined in
packages/framework/block-std/dist/extension/service.d.ts:28
Properties
disposables
readonly
disposables:DisposableGroup
Inherited from
Defined in
packages/framework/block-std/dist/extension/service.d.ts:20
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
viewportUpdated
viewportUpdated:
Slot
<Viewport
>
Defined in
packages/blocks/src/root-block/page/page-root-service.ts:11
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
transformers
transformers:
object
html
html:
object
=HtmlTransformer
html.exportDoc()
html.exportDoc: (
doc
) =>Promise
<void
>
Exports a doc to HTML format.
Parameters
• doc: 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: 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: DocCollection
• docs: Doc
[]
Returns
Promise
<void
>
zip.importDocs()
zip.importDocs: (
collection
,imported
) =>Promise
<(undefined
|Doc
)[]>
Parameters
• collection: DocCollection
• 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/page/page-root-service.ts:9
Accessors
collection
get
collection():DocCollection
Returns
Inherited from
Defined in
packages/framework/block-std/dist/extension/service.d.ts:23
doc
get
doc():Doc
Returns
Inherited from
Defined in
packages/framework/block-std/dist/extension/service.d.ts:24
host
get
host():EditorHost
Returns
Inherited from
Defined in
packages/framework/block-std/dist/extension/service.d.ts:25
selectedBlocks
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
selectedModels():BlockModel
<object
,SignaledProps
<object
>>[]
Returns
BlockModel
<object
, SignaledProps
<object
>>[]
Inherited from
Defined in
packages/blocks/src/root-block/root-service.ts:51
selectionManager
get
selectionManager():SelectionManager
Returns
Inherited from
Defined in
packages/framework/block-std/dist/extension/service.d.ts:26
uiEventDispatcher
get
uiEventDispatcher():UIEventDispatcher
Returns
Inherited from
Defined in
packages/framework/block-std/dist/extension/service.d.ts:27
viewportElement
get
viewportElement():null
|HTMLElement
Returns
null
| HTMLElement
Inherited from
Defined in
packages/blocks/src/root-block/root-service.ts:55
Methods
bindHotKey()
bindHotKey(
keymap
,options
?):void
Parameters
• keymap: Record
<string
, UIEventHandler
>
• options?
• options.global?: boolean
Returns
void
Inherited from
Defined in
packages/framework/block-std/dist/extension/service.d.ts:32
dispose()
dispose():
void
Returns
void
Inherited from
Defined in
packages/framework/block-std/dist/extension/service.d.ts:35
handleEvent()
handleEvent(
name
,fn
,options
?):void
Parameters
• name: "pan"
| "click"
| "blur"
| "focus"
| "doubleClick"
| "tripleClick"
| "pointerDown"
| "pointerMove"
| "pointerUp"
| "pointerOut"
| "dragStart"
| "dragMove"
| "dragEnd"
| "pinch"
| "keyDown"
| "keyUp"
| "selectionChange"
| "compositionStart"
| "compositionUpdate"
| "compositionEnd"
| "cut"
| "copy"
| "paste"
| "beforeInput"
| "drop"
| "contextMenu"
| "wheel"
• fn: UIEventHandler
• options?
• options.global?: boolean
Returns
void
Inherited from
Defined in
packages/framework/block-std/dist/extension/service.d.ts:36
mounted()
mounted():
void
Returns
void
Inherited from
Defined in
packages/blocks/src/root-block/root-service.ts:66
unmounted()
unmounted():
void
Returns
void
Inherited from
Defined in
packages/framework/block-std/dist/extension/service.d.ts:40
setup()
static
setup(di
):void
Parameters
• di: Container
Returns
void
Inherited from
Defined in
packages/framework/block-std/dist/extension/service.d.ts:31