Skip to main content

@lexical/html

Interfaces

DOMExtensionOutput

Defined in: packages/lexical-html/src/index.ts:496

Properties

defaults

defaults: ContextRecord

Defined in: packages/lexical-html/src/index.ts:497

Type Aliases

AnyStateConfigPair

AnyStateConfigPair = StateConfigPair<any, any>

Defined in: packages/lexical-html/src/index.ts:494


StateConfigPair

StateConfigPair<K, V> = readonly [StateConfig<K, V>, V]

Defined in: packages/lexical-html/src/index.ts:489

Type Parameters

K

K extends string

V

V

Variables

DOMContextClipboard

const DOMContextClipboard: StateConfig<"@lexical/html/clipboard", boolean>

Defined in: packages/lexical-html/src/index.ts:485

true if the DOM is for or from the clipboard


DOMContextExport

const DOMContextExport: StateConfig<"@lexical/html/export", boolean>

Defined in: packages/lexical-html/src/index.ts:481

true if this is an export operation ($generateHtmlFromNodes)

Functions

$generateDOMFromNodes()

$generateDOMFromNodes<T>(container, selection, editor): T

Defined in: packages/lexical-html/src/index.ts:568

Type Parameters

T

T extends HTMLElement | DocumentFragment

Parameters

container

T

selection

null | BaseSelection

editor

LexicalEditor = ...

Returns

T


$generateHtmlFromNodes()

$generateHtmlFromNodes(editor, selection): string

Defined in: packages/lexical-html/src/index.ts:88

Parameters

editor

LexicalEditor

selection

null | BaseSelection

Returns

string


$generateNodesFromDOM()

$generateNodesFromDOM(editor, dom): LexicalNode[]

Defined in: packages/lexical-html/src/index.ts:57

How you parse your html string to get a document is left up to you. In the browser you can use the native DOMParser API to generate a document (see clipboard.ts), but to use in a headless environment you can use JSDom or an equivalent library and pass in the document here.

Parameters

editor

LexicalEditor

dom

Document | ParentNode

Returns

LexicalNode[]


$getDOMContextValue()

$getDOMContextValue<K, V>(cfg, editor): V

Defined in: packages/lexical-html/src/index.ts:534

Type Parameters

K

K extends string

V

V

Parameters

cfg

StateConfig<K, V>

editor

LexicalEditor = ...

Returns

V


$withDOMContext()

$withDOMContext(cfg, editor): <T>(f) => T

Defined in: packages/lexical-html/src/index.ts:545

Parameters

cfg

Iterable<AnyStateConfigPair>

editor

LexicalEditor = ...

Returns

<T>(f): T

Type Parameters
T

T

Parameters
f

() => T

Returns

T


getContextValueFromRecord()

getContextValueFromRecord<K, V>(context, cfg): V

Defined in: packages/lexical-html/src/index.ts:526

Type Parameters

K

K extends string

V

V

Parameters

context

ContextRecord

cfg

StateConfig<K, V>

Returns

V