Skip to content

BlockSuite API Documentation / @blocksuite/blocks / EdgelessTextBlockComponent

Class: EdgelessTextBlockComponent

Extends

Constructors

new EdgelessTextBlockComponent()

new EdgelessTextBlockComponent(): EdgelessTextBlockComponent

Returns

EdgelessTextBlockComponent

Inherited from

GfxBlockComponent.constructor

Defined in

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

Other

_disposables

protected _disposables: DisposableGroup

Inherited from

GfxBlockComponent._disposables

Defined in

packages/framework/global/dist/utils/with-disposable.d.ts:5


[blockComponentSymbol]

[blockComponentSymbol]: boolean

Inherited from

GfxBlockComponent.[blockComponentSymbol]

Defined in

packages/framework/block-std/dist/view/element/block-component.d.ts:14


[GfxElementSymbol]

[GfxElementSymbol]: boolean

Inherited from

GfxBlockComponent.[GfxElementSymbol]

Defined in

packages/framework/block-std/dist/view/element/gfx-block-component.d.ts:7


disposables

readonly disposables: DisposableGroup

Inherited from

GfxBlockComponent.disposables

Defined in

packages/framework/global/dist/utils/with-disposable.d.ts:6


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" | "nativeDragStart" | "nativeDragMove" | "nativeDragEnd" | "nativeDrop" | "beforeInput" | "blur" | "focus" | "contextMenu" | "wheel"

handler

UIEventHandler

options?
flavour

boolean

global

boolean

Returns

void

Inherited from

GfxBlockComponent.handleEvent

Defined in

packages/framework/block-std/dist/view/element/block-component.d.ts:15


virtualKeyboardPolicy

virtualKeyboardPolicy: string

Inherited from

GfxBlockComponent.virtualKeyboardPolicy

Defined in

packages/framework/global/dist/types/virtual-keyboard.d.ts:20


connectedCount

static connectedCount: WeakMap<Constructor, WeakMap<Node, number>>

Inherited from

GfxBlockComponent.connectedCount

Defined in

packages/framework/block-std/dist/view/element/shadowless-element.d.ts:5


onDisconnectedMap

static onDisconnectedMap: WeakMap<Constructor, null | () => void>

Inherited from

GfxBlockComponent.onDisconnectedMap

Defined in

packages/framework/block-std/dist/view/element/shadowless-element.d.ts:6


_renderers

Inherited from

GfxBlockComponent._renderers

Defined in

packages/framework/block-std/dist/view/element/block-component.d.ts:53


blockId

Get Signature

get blockId(): string

Returns

string

Inherited from

GfxBlockComponent.blockId

Defined in

packages/framework/block-std/dist/view/element/block-component.d.ts:19


childBlocks

Get Signature

get childBlocks(): BlockComponent<BlockModel<object, object>, BlockService, string>[]

Returns

BlockComponent<BlockModel<object, object>, BlockService, string>[]

Inherited from

GfxBlockComponent.childBlocks

Defined in

packages/framework/block-std/dist/view/element/block-component.d.ts:20


childrenContainer

Defined in

packages/blocks/src/edgeless-text-block/edgeless-text-block.ts:341


doc

Inherited from

GfxBlockComponent.doc

Defined in

packages/framework/block-std/dist/view/element/block-component.d.ts:55


flavour

Get Signature

get flavour(): string

Returns

string

Inherited from

GfxBlockComponent.flavour

Defined in

packages/framework/block-std/dist/view/element/block-component.d.ts:21


gfx

Get Signature

get gfx(): GfxController

Returns

GfxController

Inherited from

GfxBlockComponent.gfx

Defined in

packages/framework/block-std/dist/view/element/gfx-block-component.d.ts:8


host

Get Signature

get host(): EditorHost

Returns

EditorHost

Inherited from

GfxBlockComponent.host

Defined in

packages/framework/block-std/dist/view/element/block-component.d.ts:22


isVersionMismatch

Get Signature

get isVersionMismatch(): boolean

Returns

boolean

Inherited from

GfxBlockComponent.isVersionMismatch

Defined in

packages/framework/block-std/dist/view/element/block-component.d.ts:23


model

Get Signature

get model(): Model

Returns

Model

Inherited from

GfxBlockComponent.model

Defined in

packages/framework/block-std/dist/view/element/block-component.d.ts:24


parentComponent

Get Signature

get parentComponent(): null | BlockComponent<BlockModel<object, SignaledProps<object>>, BlockService, string>

Returns

null | BlockComponent<BlockModel<object, SignaledProps<object>>, BlockService, string>

Inherited from

GfxBlockComponent.parentComponent

Defined in

packages/framework/block-std/dist/view/element/block-component.d.ts:25


renderChildren

Get Signature

get renderChildren(): (model, filter?) => TemplateResult

Returns

Function

Parameters
model

BlockModel<object, SignaledProps<object>>

filter?

(model) => boolean

Returns

TemplateResult

Inherited from

GfxBlockComponent.renderChildren

Defined in

packages/framework/block-std/dist/view/element/block-component.d.ts:26


rootComponent

Get Signature

get rootComponent(): null | BlockComponent<BlockModel<object, SignaledProps<object>>, BlockService, string>

Returns

null | BlockComponent<BlockModel<object, SignaledProps<object>>, BlockService, string>

Inherited from

GfxBlockComponent.rootComponent

Defined in

packages/framework/block-std/dist/view/element/block-component.d.ts:27


rootService

Get Signature

get rootService(): EdgelessRootService

Returns

EdgelessRootService

Defined in

packages/blocks/src/edgeless-text-block/edgeless-text-block.ts:47


selected

Get Signature

get selected(): null | BaseSelection

Returns

null | BaseSelection

Inherited from

GfxBlockComponent.selected

Defined in

packages/framework/block-std/dist/view/element/block-component.d.ts:28


selection

Get Signature

get selection(): SelectionManager

Returns

SelectionManager

Inherited from

GfxBlockComponent.selection

Defined in

packages/framework/block-std/dist/view/element/block-component.d.ts:29


service

Get Signature

get service(): Service

Returns

Service

Inherited from

GfxBlockComponent.service

Defined in

packages/framework/block-std/dist/view/element/block-component.d.ts:30


std

Inherited from

GfxBlockComponent.std

Defined in

packages/framework/block-std/dist/view/element/block-component.d.ts:12


topContenteditableElement

Get Signature

get topContenteditableElement(): null | BlockComponent<BlockModel<object, SignaledProps<object>>, BlockService, string>

Returns

null | BlockComponent<BlockModel<object, SignaledProps<object>>, BlockService, string>

Inherited from

GfxBlockComponent.topContenteditableElement

Defined in

packages/framework/block-std/dist/view/element/block-component.d.ts:31


viewType

Inherited from

GfxBlockComponent.viewType

Defined in

packages/framework/block-std/dist/view/element/block-component.d.ts:56


widgetComponents

Get Signature

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

GfxBlockComponent.widgetComponents

Defined in

packages/framework/block-std/dist/view/element/block-component.d.ts:32


widgets

Inherited from

GfxBlockComponent.widgets

Defined in

packages/framework/block-std/dist/view/element/block-component.d.ts:57


addRenderer()

addRenderer(renderer): void

Parameters

renderer

(content) => unknown

Returns

void

Inherited from

GfxBlockComponent.addRenderer

Defined in

packages/framework/block-std/dist/view/element/block-component.d.ts:35


bindHotKey()

bindHotKey(keymap, options?): () => void

Parameters

keymap

Record<string, UIEventHandler>

options?
flavour

boolean

global

boolean

Returns

Function

Returns

void

Inherited from

GfxBlockComponent.bindHotKey

Defined in

packages/framework/block-std/dist/view/element/block-component.d.ts:36


checkWidthOverflow()

checkWidthOverflow(width): boolean

Parameters

width

number

Returns

boolean

Defined in

packages/blocks/src/edgeless-text-block/edgeless-text-block.ts:74


connectedCallback()

connectedCallback(): void

Returns

void

Overrides

GfxBlockComponent.connectedCallback

Defined in

packages/blocks/src/edgeless-text-block/edgeless-text-block.ts:89


disconnectedCallback()

disconnectedCallback(): void

Returns

void

Inherited from

GfxBlockComponent.disconnectedCallback

Defined in

packages/framework/block-std/dist/view/element/block-component.d.ts:41


getCSSTransform()

getCSSTransform(): string

Returns

string

Overrides

GfxBlockComponent.getCSSTransform

Defined in

packages/blocks/src/edgeless-text-block/edgeless-text-block.ts:230


getRenderingRect()

getRenderingRect(): object

Returns

object

h

h: number

rotate

rotate: number

w

w: undefined | number

x

x: number = bound.x

y

y: number = bound.y

zIndex

zIndex: string

Overrides

GfxBlockComponent.getRenderingRect

Defined in

packages/blocks/src/edgeless-text-block/edgeless-text-block.ts:243


renderBlock()

renderBlock(): unknown

Returns

unknown

Inherited from

GfxBlockComponent.renderBlock

Defined in

packages/framework/block-std/dist/view/element/gfx-block-component.d.ts:18


renderGfxBlock()

renderGfxBlock(): TemplateResult<1>

Returns

TemplateResult<1>

Overrides

GfxBlockComponent.renderGfxBlock

Defined in

packages/blocks/src/edgeless-text-block/edgeless-text-block.ts:258


renderPageContent()

renderPageContent(): TemplateResult<1>

Returns

TemplateResult<1>

Overrides

GfxBlockComponent.renderPageContent

Defined in

packages/blocks/src/edgeless-text-block/edgeless-text-block.ts:292


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

GfxBlockComponent.renderVersionMismatch

Defined in

packages/framework/block-std/dist/view/element/block-component.d.ts:51


toZIndex()

toZIndex(): string

Returns

string

Inherited from

GfxBlockComponent.toZIndex

Defined in

packages/framework/block-std/dist/view/element/gfx-block-component.d.ts:22


tryFocusEnd()

tryFocusEnd(): void

Returns

void

Defined in

packages/blocks/src/edgeless-text-block/edgeless-text-block.ts:315


updateZIndex()

updateZIndex(): void

Returns

void

Inherited from

GfxBlockComponent.updateZIndex

Defined in

packages/framework/block-std/dist/view/element/gfx-block-component.d.ts:23

rendering

createRenderRoot()

createRenderRoot(): this

Returns

this

Inherited from

GfxBlockComponent.createRenderRoot

Defined in

packages/framework/block-std/dist/view/element/shadowless-element.d.ts:11


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

GfxBlockComponent.render

Defined in

packages/framework/block-std/dist/view/element/block-component.d.ts:43

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:

html
<script>
  // Generated and unique per request:
  window.litNonce = 'a1b2c3d4';
</script>

Nocollapse

Overrides

GfxBlockComponent.styles

Defined in

packages/blocks/src/edgeless-text-block/edgeless-text-block.ts:19


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

GfxBlockComponent.finalizeStyles

Defined in

packages/framework/block-std/dist/view/element/shadowless-element.d.ts:7

updates

firstUpdated()

firstUpdated(props): void

Invoked when the element is first updated. Implement to perform one time work on the element after update.

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

Parameters

props

Map<string, unknown>

Returns

void

Overrides

GfxBlockComponent.firstUpdated

Defined in

packages/blocks/src/edgeless-text-block/edgeless-text-block.ts:133


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:

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.

Inherited from

GfxBlockComponent.getUpdateComplete

Defined in

packages/framework/block-std/dist/view/element/block-component.d.ts:42


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:

ts
override protected async scheduleUpdate(): Promise<unknown> {
  await new Promise((resolve) => requestAnimationFrame(() => resolve()));
  super.scheduleUpdate();
}

Returns

Promise<void>

Inherited from

GfxBlockComponent.scheduleUpdate

Defined in

packages/framework/block-std/dist/view/element/gfx-block-component.d.ts:21