Skip to content

BlockSuite API Documentation / @blocksuite/inline / VElement

Class: VElement<T>

Extends

  • LitElement<this>

Type Parameters

T extends BaseTextAttributes = BaseTextAttributes

Constructors

new VElement()

new VElement<T>(): VElement<T>

Returns

VElement<T>

Inherited from

SignalWatcher(LitElement).constructor

Defined in

node_modules/@lit/reactive-element/development/reactive-element.d.ts:504

Other

disposables

readonly disposables: DisposableGroup

Defined in

packages/framework/inline/src/components/v-element.ts:18


selected

readonly selected: Signal<boolean>

Defined in

packages/framework/inline/src/components/v-element.ts:20


delta

Defined in

packages/framework/inline/src/components/v-element.ts:93


endOffset

Defined in

packages/framework/inline/src/components/v-element.ts:98


inlineEditor

Defined in

packages/framework/inline/src/components/v-element.ts:101


lineIndex

Defined in

packages/framework/inline/src/components/v-element.ts:104


startOffset

Defined in

packages/framework/inline/src/components/v-element.ts:107

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.

ts
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

SignalWatcher(LitElement).connectedCallback

Defined in

packages/framework/inline/src/components/v-element.ts:22

rendering

createRenderRoot()

createRenderRoot(): VElement<T>

Returns

VElement<T>

Overrides

SignalWatcher(LitElement).createRenderRoot

Defined in

packages/framework/inline/src/components/v-element.ts:38


render()

render(): TemplateResult<1>

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

TemplateResult<1>

Overrides

SignalWatcher(LitElement).render

Defined in

packages/framework/inline/src/components/v-element.ts:52

updates

getUpdateComplete()

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:

ts
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.

Overrides

SignalWatcher(LitElement).getUpdateComplete

Defined in

packages/framework/inline/src/components/v-element.ts:42