Skip to content

BlockSuite API Documentation / @blocksuite/blocks / HtmlAdapter

Class: HtmlAdapter

Extends

Constructors

new HtmlAdapter()

new HtmlAdapter(): HtmlAdapter

Returns

HtmlAdapter

Inherited from

BaseAdapter.constructor

Properties

configs

protected configs: Map<string, unknown>

Inherited from

BaseAdapter.configs

Source

packages/framework/store/dist/adapter/base.d.ts:41

Methods

_astToHtml()

private _astToHtml(ast): string

Parameters

ast: Root

Returns

string

Source

packages/blocks/src/_common/adapters/html.ts:248


_deltaToHast()

private _deltaToHast(deltas): (Text | Element)[]

Parameters

deltas: DeltaInsert<AffineTextAttributes>[]

Returns

(Text | Element)[]

Source

packages/blocks/src/_common/adapters/html.ts:1155


_deltaToHighlightHasts()

private _deltaToHighlightHasts(deltas, rawLang): Promise<ElementContent[]>

Parameters

deltas: DeltaInsert[]

rawLang: unknown

Returns

Promise<ElementContent[]>

Source

packages/blocks/src/_common/adapters/html.ts:1085


_hastToDelta()

private _hastToDelta(ast, option): DeltaInsert<object>[]

Parameters

ast: HtmlAST

option= undefined

option.pageMap?: Map<string, string>

option.trim?: boolean

Returns

DeltaInsert<object>[]

Source

packages/blocks/src/_common/adapters/html.ts:1339


_hastToDeltaSpreaded()

private _hastToDeltaSpreaded(ast, option): DeltaInsert<object>[]

Parameters

ast: HtmlAST

option= undefined

option.trim?: boolean

Returns

DeltaInsert<object>[]

Source

packages/blocks/src/_common/adapters/html.ts:1228


_htmlToAst()

private _htmlToAst(html): Root

Parameters

html: string

Returns

Root

Source

packages/blocks/src/_common/adapters/html.ts:252


_traverseHtml()

private _traverseHtml(html, snapshot, assets?): Promise<BlockSnapshot>

Parameters

html: HtmlAST

snapshot: BlockSnapshot

assets?: AssetsManager

Returns

Promise<BlockSnapshot>

Source

packages/blocks/src/_common/adapters/html.ts:686


_traverseSnapshot()

private _traverseSnapshot(snapshot, html, assets?): Promise<object>

Parameters

snapshot: BlockSnapshot

html: HtmlAST

assets?: AssetsManager

Returns

Promise<object>

assetsIds

assetsIds: string[]

ast

ast: Root

Source

packages/blocks/src/_common/adapters/html.ts:256


applyConfigs()

applyConfigs(configs): void

Parameters

configs: Map<string, unknown>

Returns

void

Inherited from

BaseAdapter.applyConfigs

Source

packages/framework/store/dist/adapter/base.d.ts:48


fromBlockSnapshot()

fromBlockSnapshot(payload): Promise<FromBlockSnapshotResult<string>>

Parameters

payload: FromBlockSnapshotPayload

Returns

Promise<FromBlockSnapshotResult<string>>

Overrides

BaseAdapter.fromBlockSnapshot

Source

packages/blocks/src/_common/adapters/html.ts:85


fromDocSnapshot()

fromDocSnapshot(payload): Promise<FromDocSnapshotResult<string>>

Parameters

payload: FromDocSnapshotPayload

Returns

Promise<FromDocSnapshotResult<string>>

Overrides

BaseAdapter.fromDocSnapshot

Source

packages/blocks/src/_common/adapters/html.ts:70


fromSliceSnapshot()

fromSliceSnapshot(payload): Promise<FromSliceSnapshotResult<string>>

Parameters

payload: FromSliceSnapshotPayload

Returns

Promise<FromSliceSnapshotResult<string>>

Overrides

BaseAdapter.fromSliceSnapshot

Source

packages/blocks/src/_common/adapters/html.ts:106


toBlockSnapshot()

toBlockSnapshot(payload): Promise<BlockSnapshot>

Parameters

payload: ToBlockSnapshotPayload<string>

Returns

Promise<BlockSnapshot>

Overrides

BaseAdapter.toBlockSnapshot

Source

packages/blocks/src/_common/adapters/html.ts:190


toDocSnapshot()

toDocSnapshot(payload): Promise<DocSnapshot>

Parameters

payload: ToDocSnapshotPayload<string>

Returns

Promise<DocSnapshot>

Overrides

BaseAdapter.toDocSnapshot

Source

packages/blocks/src/_common/adapters/html.ts:130


toSliceSnapshot()

toSliceSnapshot(payload): Promise<null | SliceSnapshot>

Parameters

payload: HtmlToSliceSnapshotPayload

Returns

Promise<null | SliceSnapshot>

Overrides

BaseAdapter.toSliceSnapshot

Source

packages/blocks/src/_common/adapters/html.ts:213