Skip to content

BlockSuite API Documentation / @blocksuite/blocks / RichText

Class: RichText

Extends

  • RichText_base

Constructors

new RichText()

new RichText(): RichText

Returns

RichText

Inherited from

RichText_base.constructor

Defined in

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

Other

_disposables

protected _disposables: DisposableGroup

Inherited from

RichText_base._disposables

Defined in

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


disposables

readonly disposables: DisposableGroup

Inherited from

RichText_base.disposables

Defined in

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


virtualKeyboardPolicy

virtualKeyboardPolicy: string

Inherited from

RichText_base.virtualKeyboardPolicy

Defined in

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


connectedCount

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

Inherited from

RichText_base.connectedCount

Defined in

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


onDisconnectedMap

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

Inherited from

RichText_base.onDisconnectedMap

Defined in

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


styles

static styles: CSSResult

Overrides

RichText_base.styles

Defined in

packages/affine/components/dist/rich-text/rich-text.d.ts:12


attributeRenderer

Defined in

packages/affine/components/dist/rich-text/rich-text.d.ts:29


attributesSchema

Defined in

packages/affine/components/dist/rich-text/rich-text.d.ts:30


embedChecker

Defined in

packages/affine/components/dist/rich-text/rich-text.d.ts:31


enableAutoScrollHorizontally

Defined in

packages/affine/components/dist/rich-text/rich-text.d.ts:32


enableClipboard

Defined in

packages/affine/components/dist/rich-text/rich-text.d.ts:33


enableFormat

Defined in

packages/affine/components/dist/rich-text/rich-text.d.ts:34


enableUndoRedo

Defined in

packages/affine/components/dist/rich-text/rich-text.d.ts:35


inlineEditor

Get Signature

get inlineEditor(): null | AffineInlineEditor

Returns

null | AffineInlineEditor

Defined in

packages/affine/components/dist/rich-text/rich-text.d.ts:20


inlineEditorContainer

Get Signature

get inlineEditorContainer(): HTMLDivElement

Returns

HTMLDivElement

Defined in

packages/affine/components/dist/rich-text/rich-text.d.ts:21


inlineEventSource

Defined in

packages/affine/components/dist/rich-text/rich-text.d.ts:36


inlineRangeProvider

Defined in

packages/affine/components/dist/rich-text/rich-text.d.ts:37


markdownShortcutHandler

Defined in

packages/affine/components/dist/rich-text/rich-text.d.ts:38


readonly

Defined in

packages/affine/components/dist/rich-text/rich-text.d.ts:39


undoManager

Defined in

packages/affine/components/dist/rich-text/rich-text.d.ts:40


verticalScrollContainerGetter

Defined in

packages/affine/components/dist/rich-text/rich-text.d.ts:41


vLineRenderer

Defined in

packages/affine/components/dist/rich-text/rich-text.d.ts:42


wrapText

Defined in

packages/affine/components/dist/rich-text/rich-text.d.ts:43


yText

Defined in

packages/affine/components/dist/rich-text/rich-text.d.ts:44


connectedCallback()

connectedCallback(): void

Returns

void

Overrides

RichText_base.connectedCallback

Defined in

packages/affine/components/dist/rich-text/rich-text.d.ts:24

lifecycle

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.

ts
disconnectedCallback() {
  super.disconnectedCallback();
  window.removeEventListener('keydown', this._handleKeydown);
}

An element may be re-connected after being disconnected.

Returns

void

Inherited from

RichText_base.disconnectedCallback

Defined in

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

rendering

createRenderRoot()

createRenderRoot(): this

Returns

this

Inherited from

RichText_base.createRenderRoot

Defined in

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


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

RichText_base.render

Defined in

packages/affine/components/dist/rich-text/rich-text.d.ts:26

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

RichText_base.finalizeStyles

Defined in

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

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

RichText_base.getUpdateComplete

Defined in

packages/affine/components/dist/rich-text/rich-text.d.ts:25


updated()

updated(changedProperties): void

Invoked whenever the element is updated. Implement to perform post-updating tasks via DOM APIs, for example, focusing an element.

Setting properties inside this method will trigger the element to update again after this update cycle completes.

Parameters

changedProperties

Map<string | number | symbol, unknown>

Returns

void

Overrides

RichText_base.updated

Defined in

packages/affine/components/dist/rich-text/rich-text.d.ts:27