Skip to content

BlockSuite API Documentation / @blocksuite/blocks / EmbedSyncedDocBlockComponent

Class: EmbedSyncedDocBlockComponent

Extends

Constructors

new EmbedSyncedDocBlockComponent()

new EmbedSyncedDocBlockComponent(): EmbedSyncedDocBlockComponent

Returns

EmbedSyncedDocBlockComponent

Inherited from

EmbedBlockComponent.constructor

Defined in

packages/affine/components/dist/caption/captioned-block-component.d.ts:14

Other

_buildPreviewSpec()

protected _buildPreviewSpec: (name) => ExtensionType[]

Parameters

name: "edgeless:preview" | "page:preview"

Returns

ExtensionType[]

Defined in

packages/affine/block-embed/dist/embed-synced-doc-block/embed-synced-doc-block.d.ts:12


_cardStyle

_cardStyle: EmbedCardStyle

Inherited from

EmbedBlockComponent._cardStyle

Defined in

packages/affine/block-embed/dist/common/embed-block-element.d.ts:10


_disposables

protected _disposables: DisposableGroup

Inherited from

EmbedBlockComponent._disposables

Defined in

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


_renderSyncedView()

protected _renderSyncedView: () => TemplateResult<1>

Returns

TemplateResult<1>

Defined in

packages/affine/block-embed/dist/embed-synced-doc-block/embed-synced-doc-block.d.ts:13


_scale

protected _scale: number

The actual rendered scale of the embed card. By default, it is set to 1.

Inherited from

EmbedBlockComponent._scale

Defined in

packages/affine/block-embed/dist/common/embed-block-element.d.ts:15


[blockComponentSymbol]

[blockComponentSymbol]: boolean

Inherited from

EmbedBlockComponent.[blockComponentSymbol]

Defined in

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


cardStyleMap

protected cardStyleMap: DirectiveResult<typeof StyleMapDirective>

Defined in

packages/affine/block-embed/dist/embed-synced-doc-block/embed-synced-doc-block.d.ts:14


convertToCard()

convertToCard: () => void

Returns

void

Defined in

packages/affine/block-embed/dist/embed-synced-doc-block/embed-synced-doc-block.d.ts:15


covertToInline()

covertToInline: () => void

Returns

void

Defined in

packages/affine/block-embed/dist/embed-synced-doc-block/embed-synced-doc-block.d.ts:16


disposables

readonly disposables: DisposableGroup

Inherited from

EmbedBlockComponent.disposables

Defined in

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


embedContainerStyle

protected embedContainerStyle: StyleInfo

The style of the embed card. You can use this to change the height and width of the card. By default, the height and width are set to _cardHeight and _cardWidth respectively.

Overrides

EmbedBlockComponent.embedContainerStyle

Defined in

packages/affine/block-embed/dist/embed-synced-doc-block/embed-synced-doc-block.d.ts:17


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?

options.flavour?: boolean

options.global?: boolean

Returns

void

Inherited from

EmbedBlockComponent.handleEvent

Defined in

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


open()

open: () => void

Returns

void

Defined in

packages/affine/block-embed/dist/embed-synced-doc-block/embed-synced-doc-block.d.ts:18


refreshData()

refreshData: () => void

Returns

void

Defined in

packages/affine/block-embed/dist/embed-synced-doc-block/embed-synced-doc-block.d.ts:19


renderEmbed()

renderEmbed: (content) => TemplateResult<1>

Parameters

content

Returns

TemplateResult<1>

Inherited from

EmbedBlockComponent.renderEmbed

Defined in

packages/affine/block-embed/dist/common/embed-block-element.d.ts:22


virtualKeyboardPolicy

virtualKeyboardPolicy: string

Inherited from

EmbedBlockComponent.virtualKeyboardPolicy

Defined in

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


disableShadowRoot

static disableShadowRoot: boolean

Inherited from

EmbedBlockComponent.disableShadowRoot

Defined in

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


_cardHeight

get _cardHeight(): number

The height of the current embed card. Changes based on the card style.

Returns

number

Inherited from

EmbedBlockComponent._cardHeight

Defined in

packages/affine/block-embed/dist/common/embed-block-element.d.ts:26


_cardWidth

get _cardWidth(): number

The width of the current embed card. Changes based on the card style.

Returns

number

Inherited from

EmbedBlockComponent._cardWidth

Defined in

packages/affine/block-embed/dist/common/embed-block-element.d.ts:30


_isEmptySyncedDoc

Defined in

packages/affine/block-embed/dist/embed-synced-doc-block/embed-synced-doc-block.d.ts:46


_renderers

Inherited from

EmbedBlockComponent._renderers

Defined in

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


blockContainerStyles

Inherited from

EmbedBlockComponent.blockContainerStyles

Defined in

packages/affine/block-embed/dist/common/embed-block-element.d.ts:34


blockId

get blockId(): string

Returns

string

Inherited from

EmbedBlockComponent.blockId

Defined in

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


blockState

get blockState(): object

Returns

object

isCycle

isCycle: boolean

isDeleted

isDeleted: boolean

isError

isError: boolean

isLoading

isLoading: boolean

Defined in

packages/affine/block-embed/dist/embed-synced-doc-block/embed-synced-doc-block.d.ts:21


captionEditor

get captionEditor(): undefined | BlockCaptionEditor<BlockModel<BlockCaptionProps, BlockCaptionProps & object>>

Returns

undefined | BlockCaptionEditor<BlockModel<BlockCaptionProps, BlockCaptionProps & object>>

Inherited from

EmbedBlockComponent.captionEditor

Defined in

packages/affine/components/dist/caption/captioned-block-component.d.ts:11


childBlocks

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

Returns

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

Inherited from

EmbedBlockComponent.childBlocks

Defined in

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


depth

Defined in

packages/affine/block-embed/dist/embed-synced-doc-block/embed-synced-doc-block.d.ts:48


doc

Inherited from

EmbedBlockComponent.doc

Defined in

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


docTitle

get docTitle(): string

Returns

string

Defined in

packages/affine/block-embed/dist/embed-synced-doc-block/embed-synced-doc-block.d.ts:27


docUpdatedAt

get docUpdatedAt(): Date

Returns

Date

Defined in

packages/affine/block-embed/dist/embed-synced-doc-block/embed-synced-doc-block.d.ts:28


editorMode

get editorMode(): DocMode

Returns

DocMode

Defined in

packages/affine/block-embed/dist/embed-synced-doc-block/embed-synced-doc-block.d.ts:29


embedBlock

Inherited from

EmbedBlockComponent.embedBlock

Defined in

packages/affine/block-embed/dist/common/embed-block-element.d.ts:35


fetchAbortController

get fetchAbortController(): AbortController

Returns

AbortController

Inherited from

EmbedBlockComponent.fetchAbortController

Defined in

packages/affine/block-embed/dist/common/embed-block-element.d.ts:31


flavour

get flavour(): string

Returns

string

Inherited from

EmbedBlockComponent.flavour

Defined in

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


host

get host(): EditorHost

Returns

EditorHost

Inherited from

EmbedBlockComponent.host

Defined in

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


isPageMode

get protected isPageMode(): boolean

Returns

boolean

Defined in

packages/affine/block-embed/dist/embed-synced-doc-block/embed-synced-doc-block.d.ts:30


isVersionMismatch

get isVersionMismatch(): boolean

Returns

boolean

Inherited from

EmbedBlockComponent.isVersionMismatch

Defined in

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


model

get model(): Model

Returns

Model

Inherited from

EmbedBlockComponent.model

Defined in

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


parentComponent

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

Returns

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

Inherited from

EmbedBlockComponent.parentComponent

Defined in

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


renderChildren

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

Returns

Function

Parameters

model: BlockModel<object, SignaledProps<object>>

filter?

Returns

TemplateResult

Inherited from

EmbedBlockComponent.renderChildren

Defined in

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


rootComponent

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

Returns

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

Inherited from

EmbedBlockComponent.rootComponent

Defined in

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


selected

get selected(): null | BaseSelection

Returns

null | BaseSelection

Inherited from

EmbedBlockComponent.selected

Defined in

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


selectedStyle

Inherited from

EmbedBlockComponent.selectedStyle

Defined in

packages/affine/block-embed/dist/common/embed-block-element.d.ts:36


selection

get selection(): SelectionManager

Returns

SelectionManager

Inherited from

EmbedBlockComponent.selection

Defined in

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


service

get service(): Service

Returns

Service

Inherited from

EmbedBlockComponent.service

Defined in

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


std

Inherited from

EmbedBlockComponent.std

Defined in

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


syncedDoc

get syncedDoc(): null | Doc

Returns

null | Doc

Defined in

packages/affine/block-embed/dist/embed-synced-doc-block/embed-synced-doc-block.d.ts:31


syncedDocCard

Defined in

packages/affine/block-embed/dist/embed-synced-doc-block/embed-synced-doc-block.d.ts:49


syncedDocEditorHost

Defined in

packages/affine/block-embed/dist/embed-synced-doc-block/embed-synced-doc-block.d.ts:50


syncedDocMode

Defined in

packages/affine/block-embed/dist/embed-synced-doc-block/embed-synced-doc-block.d.ts:51


topContenteditableElement

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

Returns

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

Inherited from

EmbedBlockComponent.topContenteditableElement

Defined in

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


useCaptionEditor

Overrides

EmbedBlockComponent.useCaptionEditor

Defined in

packages/affine/block-embed/dist/embed-synced-doc-block/embed-synced-doc-block.d.ts:52


useZeroWidth

Inherited from

EmbedBlockComponent.useZeroWidth

Defined in

packages/affine/block-embed/dist/common/embed-block-element.d.ts:38


viewType

Inherited from

EmbedBlockComponent.viewType

Defined in

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


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

EmbedBlockComponent.widgetComponents

Defined in

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


widgets

Inherited from

EmbedBlockComponent.widgets

Defined in

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


_handleClick()

protected _handleClick(_event): void

Parameters

_event: MouseEvent

Returns

void

Defined in

packages/affine/block-embed/dist/embed-synced-doc-block/embed-synced-doc-block.d.ts:37


addRenderer()

addRenderer(renderer): void

Parameters

renderer

Returns

void

Inherited from

EmbedBlockComponent.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?

options.flavour?: boolean

options.global?: boolean

Returns

Function

Returns

void

Inherited from

EmbedBlockComponent.bindHotKey

Defined in

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


connectedCallback()

connectedCallback(): void

Returns

void

Overrides

EmbedBlockComponent.connectedCallback

Defined in

packages/affine/block-embed/dist/embed-synced-doc-block/embed-synced-doc-block.d.ts:38


disconnectedCallback()

disconnectedCallback(): void

Returns

void

Inherited from

EmbedBlockComponent.disconnectedCallback

Defined in

packages/affine/block-embed/dist/common/embed-block-element.d.ts:33


renderBlock()

renderBlock(): TemplateResult<1>

Returns

TemplateResult<1>

Overrides

EmbedBlockComponent.renderBlock

Defined in

packages/affine/block-embed/dist/embed-synced-doc-block/embed-synced-doc-block.d.ts:40


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

EmbedBlockComponent.renderVersionMismatch

Defined in

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

rendering

createRenderRoot()

createRenderRoot(): HTMLElement | DocumentFragment

Returns

HTMLElement | DocumentFragment

Inherited from

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

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

EmbedBlockComponent.styles

Defined in

packages/affine/block-embed/dist/embed-synced-doc-block/embed-synced-doc-block.d.ts:8


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

EmbedBlockComponent.finalizeStyles

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.

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.

Returns

void

Overrides

EmbedBlockComponent.firstUpdated

Defined in

packages/affine/block-embed/dist/embed-synced-doc-block/embed-synced-doc-block.d.ts:39


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

EmbedBlockComponent.getUpdateComplete

Defined in

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


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: PropertyValueMap<any> | Map<PropertyKey, unknown>

Returns

void

Overrides

EmbedBlockComponent.updated

Defined in

packages/affine/block-embed/dist/embed-synced-doc-block/embed-synced-doc-block.d.ts:41