Skip to content

BlockSuite API Documentation / @blocksuite/blocks / HtmlAdapter

Class: HtmlAdapter

Extends

Constructors

new HtmlAdapter()

new HtmlAdapter(job): HtmlAdapter

Parameters

job: Job

Returns

HtmlAdapter

Inherited from

BaseAdapter.constructor

Source

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

Properties

configs

protected configs: Map<string, unknown>

Inherited from

BaseAdapter.configs

Source

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


job

job: Job

Inherited from

BaseAdapter.job

Source

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

Methods

_astToHtml()

private _astToHtml(ast): string

Parameters

ast: Root

Returns

string

Source

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


_deltaToHast()

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

Parameters

deltas: DeltaInsert<AffineTextAttributes>[]

Returns

(Text | Element)[]

Source

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


_deltaToHighlightHasts()

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

Parameters

deltas: DeltaInsert[]

rawLang: unknown

Returns

Promise<ElementContent[]>

Source

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


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


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


_htmlToAst()

private _htmlToAst(html): Root

Parameters

html: string

Returns

Root

Source

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


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


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


applyConfigs()

applyConfigs(configs): void

Parameters

configs: Map<string, unknown>

Returns

void

Inherited from

BaseAdapter.applyConfigs

Source

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


fromBlock()

fromBlock(mode): Promise<FromBlockSnapshotResult<string>>

Parameters

mode: DraftModel

Returns

Promise<FromBlockSnapshotResult<string>>

Inherited from

BaseAdapter.fromBlock

Source

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


fromBlockSnapshot()

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

Parameters

payload: FromBlockSnapshotPayload

Returns

Promise<FromBlockSnapshotResult<string>>

Overrides

BaseAdapter.fromBlockSnapshot

Source

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


fromDoc()

fromDoc(doc): Promise<FromDocSnapshotResult<string>>

Parameters

doc: Doc

Returns

Promise<FromDocSnapshotResult<string>>

Inherited from

BaseAdapter.fromDoc

Source

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


fromDocSnapshot()

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

Parameters

payload: FromDocSnapshotPayload

Returns

Promise<FromDocSnapshotResult<string>>

Overrides

BaseAdapter.fromDocSnapshot

Source

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


fromSlice()

fromSlice(slice): Promise<FromSliceSnapshotResult<string>>

Parameters

slice: Slice

Returns

Promise<FromSliceSnapshotResult<string>>

Inherited from

BaseAdapter.fromSlice

Source

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


fromSliceSnapshot()

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

Parameters

payload: FromSliceSnapshotPayload

Returns

Promise<FromSliceSnapshotResult<string>>

Overrides

BaseAdapter.fromSliceSnapshot

Source

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


toBlock()

toBlock(payload, doc, parent?, index?): Promise<BlockModel<object>>

Parameters

payload: ToBlockSnapshotPayload<string>

doc: Doc

parent?: string

index?: number

Returns

Promise<BlockModel<object>>

Inherited from

BaseAdapter.toBlock

Source

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


toBlockSnapshot()

toBlockSnapshot(payload): Promise<BlockSnapshot>

Parameters

payload: ToBlockSnapshotPayload<string>

Returns

Promise<BlockSnapshot>

Overrides

BaseAdapter.toBlockSnapshot

Source

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


toDoc()

toDoc(payload): Promise<Doc>

Parameters

payload: ToDocSnapshotPayload<string>

Returns

Promise<Doc>

Inherited from

BaseAdapter.toDoc

Source

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


toDocSnapshot()

toDocSnapshot(payload): Promise<DocSnapshot>

Parameters

payload: ToDocSnapshotPayload<string>

Returns

Promise<DocSnapshot>

Overrides

BaseAdapter.toDocSnapshot

Source

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


toSlice()

toSlice(payload, doc, parent?, index?): Promise<undefined | Slice>

Parameters

payload: ToSliceSnapshotPayload<string>

doc: Doc

parent?: string

index?: number

Returns

Promise<undefined | Slice>

Inherited from

BaseAdapter.toSlice

Source

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


toSliceSnapshot()

toSliceSnapshot(payload): Promise<null | SliceSnapshot>

Parameters

payload: HtmlToSliceSnapshotPayload

Returns

Promise<null | SliceSnapshot>

Overrides

BaseAdapter.toSliceSnapshot

Source

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