Skip to content

BlockSuite API Documentation / @blocksuite/blocks / HtmlAdapter

Class: HtmlAdapter

Extends

Constructors

new HtmlAdapter(undefined)

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:243


_deltaToHast()

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

Parameters

deltas: DeltaInsert[]

Returns

(Text | Element)[]

Source

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


_deltaToHigglightHasts()

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

Parameters

deltas: DeltaInsert[]

rawLang: unknown

Returns

Promise<ElementContent[]>

Source

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


_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:1293


_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:1182


_htmlToAst()

private _htmlToAst(html): Root

Parameters

html: string

Returns

Root

Source

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


_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:677


_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:251


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:80


fromDocSnapshot()

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

Parameters

payload: FromDocSnapshotPayload

Returns

Promise<FromDocSnapshotResult<string>>

Overrides

BaseAdapter.fromDocSnapshot

Source

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


fromSliceSnapshot()

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

Parameters

payload: FromSliceSnapshotPayload

Returns

Promise<FromSliceSnapshotResult<string>>

Overrides

BaseAdapter.fromSliceSnapshot

Source

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


toBlockSnapshot()

toBlockSnapshot(payload): Promise<BlockSnapshot>

Parameters

payload: ToBlockSnapshotPayload<string>

Returns

Promise<BlockSnapshot>

Overrides

BaseAdapter.toBlockSnapshot

Source

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


toDocSnapshot()

toDocSnapshot(payload): Promise<DocSnapshot>

Parameters

payload: ToDocSnapshotPayload<string>

Returns

Promise<DocSnapshot>

Overrides

BaseAdapter.toDocSnapshot

Source

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


toSliceSnapshot()

toSliceSnapshot(payload): Promise<null | SliceSnapshot>

Parameters

payload: HtmlToSliceSnapshotPayload

Returns

Promise<null | SliceSnapshot>

Overrides

BaseAdapter.toSliceSnapshot

Source

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