BlockSuite API Documentation / @blocksuite/block-std / GfxBlockComponent
Class: abstract
GfxBlockComponent<Model, Service, WidgetName>
Extends
BlockComponent
<Model
,Service
,WidgetName
>
Extended by
Type Parameters
• Model extends EdgelessBlockModel
= EdgelessBlockModel
• Service extends BlockService
= BlockService
• WidgetName extends string
= string
Constructors
new GfxBlockComponent()
new GfxBlockComponent<
Model
,Service
,WidgetName
>():GfxBlockComponent
<Model
,Service
,WidgetName
>
Returns
GfxBlockComponent
<Model
, Service
, WidgetName
>
Inherited from
Defined in
node_modules/@lit/reactive-element/development/reactive-element.d.ts:504
Other
_disposables
protected
_disposables:DisposableGroup
Inherited from
Defined in
packages/framework/global/dist/utils/with-disposable.d.ts:5
[blockComponentSymbol]
[blockComponentSymbol]:
boolean
=true
Inherited from
BlockComponent
.[blockComponentSymbol]
Defined in
packages/framework/block-std/src/view/element/block-component.ts:49
[GfxElementSymbol]
[GfxElementSymbol]:
boolean
=true
Defined in
packages/framework/block-std/src/view/element/gfx-block-component.ts:26
disposables
readonly
disposables:DisposableGroup
Inherited from
Defined in
packages/framework/global/dist/utils/with-disposable.d.ts:6
disableShadowRoot
static
disableShadowRoot:boolean
=true
Inherited from
BlockComponent
.disableShadowRoot
Defined in
packages/framework/block-std/src/view/element/shadowless-element.ts:6
_renderers
Inherited from
Defined in
packages/framework/block-std/src/view/element/block-component.ts:298
blockId
get
blockId():string
Returns
string
Inherited from
Defined in
packages/framework/block-std/src/view/element/block-component.ts:68
childBlocks
get
childBlocks():BlockComponent
<BlockModel
<object
,SignaledProps
<object
>>,BlockService
,string
>[]
Returns
BlockComponent
<BlockModel
<object
, SignaledProps
<object
>>, BlockService
, string
>[]
Inherited from
Defined in
packages/framework/block-std/src/view/element/block-component.ts:72
doc
Inherited from
Defined in
packages/framework/block-std/src/view/element/block-component.ts:309
flavour
get
flavour():string
Returns
string
Inherited from
Defined in
packages/framework/block-std/src/view/element/block-component.ts:81
gfx
get
gfx():GfxController
Returns
GfxController
Defined in
packages/framework/block-std/src/view/element/gfx-block-component.ts:28
host
get
host():EditorHost
Returns
Inherited from
Defined in
packages/framework/block-std/src/view/element/block-component.ts:85
isVersionMismatch
get
isVersionMismatch():boolean
Returns
boolean
Inherited from
BlockComponent
.isVersionMismatch
Defined in
packages/framework/block-std/src/view/element/block-component.ts:89
model
get
model():Model
Returns
Model
Inherited from
Defined in
packages/framework/block-std/src/view/element/block-component.ts:109
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/src/view/element/block-component.ts:124
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/src/view/element/block-component.ts:130
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/src/view/element/block-component.ts:134
selected
get
selected():null
|BaseSelection
Returns
null
| BaseSelection
Inherited from
Defined in
packages/framework/block-std/src/view/element/block-component.ts:143
selection
get
selection():SelectionManager
Returns
Inherited from
Defined in
packages/framework/block-std/src/view/element/block-component.ts:147
service
get
service():Service
Returns
Service
Inherited from
Defined in
packages/framework/block-std/src/view/element/block-component.ts:151
std
Inherited from
Defined in
packages/framework/block-std/src/view/element/block-component.ts:312
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/src/view/element/block-component.ts:160
viewType
Inherited from
Defined in
packages/framework/block-std/src/view/element/block-component.ts:315
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/src/view/element/block-component.ts:164
widgets
Inherited from
Defined in
packages/framework/block-std/src/view/element/block-component.ts:330
addRenderer()
addRenderer(
renderer
):void
Parameters
• renderer
Returns
void
Inherited from
Defined in
packages/framework/block-std/src/view/element/block-component.ts:195
bindHotKey()
bindHotKey(
keymap
,options
?): () =>void
Parameters
• keymap: Record
<string
, UIEventHandler
>
• options?
• options.flavour?: boolean
• options.global?: boolean
Returns
Function
Returns
void
Inherited from
Defined in
packages/framework/block-std/src/view/element/block-component.ts:199
getRenderingRect()
getRenderingRect():
object
Returns
object
h
h:
any
w
w:
any
x
x:
any
y
y:
any
zIndex
zIndex:
string
Defined in
packages/framework/block-std/src/view/element/gfx-block-component.ts:38
handleEvent()
handleEvent(
name
,handler
,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"
| "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/src/view/element/block-component.ts:51
renderBlock()
renderBlock():
unknown
Returns
unknown
Overrides
Defined in
packages/framework/block-std/src/view/element/gfx-block-component.ts:53
renderGfxBlock()
renderGfxBlock():
unknown
Returns
unknown
Defined in
packages/framework/block-std/src/view/element/gfx-block-component.ts:65
renderPageContent()
renderPageContent():
unknown
Returns
unknown
Defined in
packages/framework/block-std/src/view/element/gfx-block-component.ts:69
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/src/view/element/block-component.ts:272
toZIndex()
toZIndex():
string
Returns
string
Defined in
packages/framework/block-std/src/view/element/gfx-block-component.ts:88
updateZIndex()
updateZIndex():
void
Returns
void
Defined in
packages/framework/block-std/src/view/element/gfx-block-component.ts:92
lifecycle
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/framework/block-std/src/view/element/gfx-block-component.ts:32
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
Inherited from
BlockComponent
.disconnectedCallback
Defined in
packages/framework/block-std/src/view/element/block-component.ts:240
rendering
createRenderRoot()
createRenderRoot():
HTMLElement
|DocumentFragment
Returns
HTMLElement
| DocumentFragment
Inherited from
BlockComponent
.createRenderRoot
Defined in
packages/framework/block-std/src/view/element/shadowless-element.ts:28
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/src/view/element/block-component.ts:255
styles
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/src/view/element/shadowless-element.ts:8
updates
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/src/view/element/block-component.ts:249
scheduleUpdate()
scheduleUpdate():
Promise
<void
>
Schedules an element update. You can override this method to change the timing of updates by returning a Promise. The update will await the returned Promise, and you should resolve the Promise to allow the update to proceed. If this method is overridden, super.scheduleUpdate()
must be called.
For instance, to schedule updates to occur just before the next frame:
override protected async scheduleUpdate(): Promise<unknown> {
await new Promise((resolve) => requestAnimationFrame(() => resolve()));
super.scheduleUpdate();
}
Returns
Promise
<void
>
Overrides
BlockComponent.scheduleUpdate
Defined in
packages/framework/block-std/src/view/element/gfx-block-component.ts:73