BlockSuite API Documentation / @blocksuite/blocks / EdgelessRootBlockComponent
Class: EdgelessRootBlockComponent
Extends
Constructors
new EdgelessRootBlockComponent()
new EdgelessRootBlockComponent():
EdgelessRootBlockComponent
Returns
Inherited from
Defined in
node_modules/.pnpm/@[email protected]/node_modules/@lit/reactive-element/development/reactive-element.d.ts:504
Other
[blockComponentSymbol]
[blockComponentSymbol]:
boolean
Inherited from
BlockComponent
.[blockComponentSymbol]
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:13
_disposables
protected
_disposables:DisposableGroup
Inherited from
Defined in
packages/framework/block-std/dist/view/utils/with-disposable.d.ts:4
clipboardController
clipboardController:
EdgelessClipboardController
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:161
components
components:
object
Shared components
toolbar
toolbar:
null
|EdgelessToolbar
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:166
disableComponents
disableComponents:
boolean
=false
Disable components
Toolbar is not allowed to display in syncd doc block
.
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:175
disposables
readonly
disposables:DisposableGroup
Inherited from
Defined in
packages/framework/block-std/dist/view/utils/with-disposable.d.ts:5
handleEvent()
handleEvent: (
name
,handler
,options
?) =>void
Parameters
• name: "pan"
| "click"
| "doubleClick"
| "tripleClick"
| "pointerDown"
| "pointerMove"
| "pointerUp"
| "pointerOut"
| "dragStart"
| "dragMove"
| "dragEnd"
| "pinch"
| "keyDown"
| "keyUp"
| "selectionChange"
| "compositionStart"
| "compositionUpdate"
| "compositionEnd"
| "cut"
| "copy"
| "paste"
| "beforeInput"
| "blur"
| "focus"
| "drop"
| "contextMenu"
| "wheel"
• handler: UIEventHandler
• options?
• options.flavour?: boolean
• options.global?: boolean
Returns
void
Inherited from
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:14
keyboardManager
keyboardManager:
null
|EdgelessPageKeyboardManager
=null
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:177
mouseRoot
mouseRoot:
HTMLElement
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:179
disableShadowRoot
static
disableShadowRoot:boolean
Inherited from
BlockComponent
.disableShadowRoot
Defined in
packages/framework/block-std/dist/view/element/shadowless-element.d.ts:4
_renderers
Inherited from
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:53
backgroundElm
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:984
blockId
get
blockId():string
Returns
string
Inherited from
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:18
childBlocks
get
childBlocks():BlockComponent
<BlockModel
<object
,object
>,BlockService
,string
>[]
Returns
BlockComponent
<BlockModel
<object
, object
>, BlockService
, string
>[]
Inherited from
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:19
dirty
Inherited from
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:55
dispatcher
get
dispatcher():UIEventDispatcher
Returns
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:181
doc
Inherited from
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:56
edgelessTool
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:987
flavour
get
flavour():string
Returns
string
Inherited from
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:20
gfxViewportElm
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:992
host
get
host():EditorHost
Returns
Inherited from
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:21
isVersionMismatch
get
isVersionMismatch():boolean
Returns
boolean
Inherited from
BlockComponent
.isVersionMismatch
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:22
model
get
model():Model
Returns
Model
Inherited from
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:23
mountElm
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:995
parentComponent
get
parentComponent():null
|BlockComponent
<BlockModel
<object
,SignaledProps
<object
>>,BlockService
,string
>
Returns
null
| BlockComponent
<BlockModel
<object
, SignaledProps
<object
>>, BlockService
, string
>
Inherited from
BlockComponent
.parentComponent
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:24
renderChildren
get
renderChildren(): (model
,filter
?) =>TemplateResult
Returns
Function
Parameters
• model: BlockModel
<object
, SignaledProps
<object
>>
• filter?
Returns
TemplateResult
Inherited from
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:25
rootComponent
get
rootComponent():null
|BlockComponent
<BlockModel
<object
,SignaledProps
<object
>>,BlockService
,string
>
Returns
null
| BlockComponent
<BlockModel
<object
, SignaledProps
<object
>>, BlockService
, string
>
Inherited from
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:26
selected
get
selected():null
|BaseSelection
Returns
null
| BaseSelection
Inherited from
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:27
selectedRect
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:998
selection
get
selection():SelectionManager
Returns
Inherited from
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:28
service
get
service():Service
Returns
Service
Inherited from
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:29
slots
get
slots():object
Returns
object
copyAsPng
copyAsPng:
Slot
<object
>
Type declaration
blocks
blocks:
EdgelessBlockModelType
[]
shapes
shapes:
SurfaceModel
[]
cursorUpdated
cursorUpdated:
Slot
<string
>
docLinkClicked
docLinkClicked:
Slot
<object
>
Type declaration
pageId
pageId:
string
params?
optional
params:object
params.blockIds?
optional
params.blockIds:string
[]
params.elementIds?
optional
params.elementIds:string
[]
params.mode?
optional
params.mode:"edgeless"
|"page"
draggingAreaUpdated
draggingAreaUpdated:
Slot
<void
>
edgelessToolUpdated
edgelessToolUpdated:
Slot
<TextTool
|BrushTool
|ConnectorTool
|CopilotSelectionTool
|EraserTool
|FrameNavigatorTool
|FrameTool
|LassoTool
|MindmapTool
|NoteTool
|PanTool
|ShapeTool
|DefaultTool
|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
>
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:185
std
Inherited from
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:57
surface
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:1001
surfaceBlockModel
get
surfaceBlockModel():SurfaceBlockModel
Returns
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:189
tools
get
tools():EdgelessToolsManager
Returns
EdgelessToolsManager
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:195
topContenteditableElement
get
topContenteditableElement():null
|BlockComponent
<BlockModel
<object
,SignaledProps
<object
>>,BlockService
,string
>
Returns
null
| BlockComponent
<BlockModel
<object
, SignaledProps
<object
>>, BlockService
, string
>
Inherited from
BlockComponent
.topContenteditableElement
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:30
viewType
Inherited from
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:58
viewport
get
viewport():Viewport
Returns
Viewport
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:199
viewportElement
get
viewportElement():HTMLElement
Returns
HTMLElement
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:221
widgetComponents
get
widgetComponents():Partial
<Record
<WidgetName
,WidgetComponent
<BlockModel
<object
,SignaledProps
<object
>>,BlockComponent
<BlockModel
<object
,SignaledProps
<object
>>,BlockService
,string
>,BlockService
>>>
Returns
Partial
<Record
<WidgetName
, WidgetComponent
<BlockModel
<object
, SignaledProps
<object
>>, BlockComponent
<BlockModel
<object
, SignaledProps
<object
>>, BlockService
, string
>, BlockService
>>>
Inherited from
BlockComponent
.widgetComponents
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:31
widgets
Inherited from
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:59
addAttachments()
addAttachments(
files
,point
?):Promise
<string
[]>
Parameters
• files: File
[]
• point?: IVec
Returns
Promise
<string
[]>
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:508
addImages()
addImages(
files
,point
?,inTopLeft
?):Promise
<string
[]>
Parameters
• files: File
[]
• point?: IVec
• inTopLeft?: boolean
Returns
Promise
<string
[]>
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:593
addNewNote()
addNewNote(
blocks
,point
,options
?):object
Adds a new note with the given blocks and point.
Parameters
• blocks: Partial
<BlockModel
<object
, SignaledProps
<object
>>>[]
Array<Partial<BlockModel>>
• point: IPoint
Point
• options?
• options.height?: number
• options.noteIndex?: number
• options.offsetX?: number
• options.offsetY?: number
• options.parentId?: string
• options.width?: number
Returns
object
ids
ids:
string
[]
noteId
noteId:
string
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:682
addNoteWithPoint()
addNoteWithPoint(
point
,options
):string
Adds a new note with the given point on the affine-editor-container.
@param: point Point @returns: The id of new note
Parameters
• point: IPoint
• options = {}
• options.height?: number
• options.noteIndex?: number
• options.offsetX?: number
• options.offsetY?: number
• options.parentId?: string
• options.scale?: number
• options.width?: number
Returns
string
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:724
addRenderer()
addRenderer(
renderer
):void
Parameters
• renderer
Returns
void
Inherited from
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:34
bindHotKey()
bindHotKey(
keymap
,options
?): () =>void
Parameters
• keymap: Record
<string
, UIEventHandler
>
• options?
• options.flavour?: boolean
• options.global?: boolean
Returns
Function
Returns
void
Overrides
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:772
connectedCallback()
connectedCallback():
void
Invoked when the component is added to the document's DOM.
In connectedCallback()
you should setup tasks that should only occur when the element is connected to the document. The most common of these is adding event listeners to nodes external to the element, like a keydown event handler added to the window.
connectedCallback() {
super.connectedCallback();
addEventListener('keydown', this._handleKeydown);
}
Typically, anything done in connectedCallback()
should be undone when the element is disconnected, in disconnectedCallback()
.
Returns
void
Overrides
BlockComponent
.connectedCallback
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:807
disconnectedCallback()
disconnectedCallback():
void
Invoked when the component is removed from the document's DOM.
This callback is the main signal to the element that it may no longer be used. disconnectedCallback()
should ensure that nothing is holding a reference to the element (such as event listeners added to nodes external to the element), so that it is free to be garbage collected.
disconnectedCallback() {
super.disconnectedCallback();
window.removeEventListener('keydown', this._handleKeydown);
}
An element may be re-connected after being disconnected.
Returns
void
Overrides
BlockComponent
.disconnectedCallback
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:843
getElementsBound()
getElementsBound():
null
|IBound
Returns
null
| IBound
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:888
renderBlock()
renderBlock():
TemplateResult
<1
>
Returns
TemplateResult
<1
>
Overrides
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:893
renderVersionMismatch()
renderVersionMismatch(
expectedVersion
,actualVersion
):TemplateResult
Render a warning message when the block version is mismatched.
Parameters
• expectedVersion: number
If the schema is not found, the expected version is -1. Which means the block is not supported in the current editor.
• actualVersion: number
The version of the block's crdt data.
Returns
TemplateResult
Inherited from
BlockComponent
.renderVersionMismatch
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:50
setSelection()
setSelection(
noteId
,_active
,blockId
,point
?):void
Parameters
• noteId: string
• _active: boolean
= true
• blockId: string
• point?: Point
Returns
void
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:954
rendering
createRenderRoot()
createRenderRoot():
HTMLElement
|DocumentFragment
Returns
HTMLElement
| DocumentFragment
Inherited from
BlockComponent
.createRenderRoot
Defined in
packages/framework/block-std/dist/view/element/shadowless-element.d.ts:6
render()
render():
unknown
Invoked on each update to perform rendering tasks. This method may return any value renderable by lit-html's ChildPart
- typically a TemplateResult
. Setting properties inside this method will not trigger the element to update.
Returns
unknown
Inherited from
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:42
styles
styles
static
styles:CSSResult
Array of styles to apply to the element. The styles should be defined using the css tag function, via constructible stylesheets, or imported from native CSS module scripts.
Note on Content Security Policy:
Element styles are implemented with <style>
tags when the browser doesn't support adopted StyleSheets. To use such <style>
tags with the style-src CSP directive, the style-src value must either include 'unsafe-inline' or nonce-<base64-value>
with <base64-value>
replaced be a server-generated nonce.
To provide a nonce to use on generated <style>
elements, set window.litNonce
to a server-generated nonce in your page's HTML, before loading application code:
<script>
// Generated and unique per request:
window.litNonce = 'a1b2c3d4';
</script>
Nocollapse
Overrides
BlockComponent.styles
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:107
finalizeStyles()
protected
static
finalizeStyles(styles
?):CSSResultOrNative
[]
Takes the styles the user supplied via the static styles
property and returns the array of styles to apply to the element. Override this method to integrate into a style management system.
Styles are deduplicated preserving the last instance in the list. This is a performance optimization to avoid duplicated styles that can occur especially when composing via subclassing. The last item is kept to try to preserve the cascade order with the assumption that it's most important that last added styles override previous styles.
Parameters
• styles?: CSSResultGroup
Returns
CSSResultOrNative
[]
Nocollapse
Inherited from
Defined in
packages/framework/block-std/dist/view/element/shadowless-element.d.ts:5
updates
firstUpdated()
firstUpdated():
void
Invoked when the element is first updated. Implement to perform one time work on the element after update.
firstUpdated() {
this.renderRoot.getElementById('my-text-area').focus();
}
Setting properties inside this method will trigger the element to update again after this update cycle completes.
Returns
void
Overrides
BlockComponent.firstUpdated
Defined in
packages/blocks/src/root-block/edgeless/edgeless-root-block.ts:856
getUpdateComplete()
protected
getUpdateComplete():Promise
<boolean
>
Override point for the updateComplete
promise.
It is not safe to override the updateComplete
getter directly due to a limitation in TypeScript which means it is not possible to call a superclass getter (e.g. super.updateComplete.then(...)
) when the target language is ES5 (https://github.com/microsoft/TypeScript/issues/338). This method should be overridden instead. For example:
class MyElement extends LitElement {
override async getUpdateComplete() {
const result = await super.getUpdateComplete();
await this._myChild.updateComplete;
return result;
}
}
Returns
Promise
<boolean
>
A promise of a boolean that resolves to true if the update completed without triggering another update.
Inherited from
BlockComponent
.getUpdateComplete
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:41
update()
protected
update(changedProperties
):void
Updates the element. This method reflects property values to attributes and calls render
to render DOM via lit-html. Setting properties inside this method will not trigger another update.
Parameters
• changedProperties: PropertyValueMap
<any
> | Map
<PropertyKey
, unknown
>
Map of changed properties with old values
Returns
void
Inherited from
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:51