Skip to main content

Module: @lexical/utils

Type Aliases

DFSNode

Ƭ DFSNode: Readonly<{ depth: number ; node: LexicalNode }>

Defined in

lexical-utils/src/index.ts:30


DOMNodeToLexicalConversion

Ƭ DOMNodeToLexicalConversion: (element: Node) => LexicalNode

Type declaration

▸ (element): LexicalNode

Parameters
NameType
elementNode
Returns

LexicalNode

Defined in

lexical-utils/src/index.ts:145


DOMNodeToLexicalConversionMap

Ƭ DOMNodeToLexicalConversionMap: Record<string, DOMNodeToLexicalConversion>

Defined in

lexical-utils/src/index.ts:147

Functions

$dfs

$dfs(startingNode?, endingNode?): DFSNode[]

Parameters

NameType
startingNode?LexicalNode
endingNode?LexicalNode

Returns

DFSNode[]

Defined in

lexical-utils/src/index.ts:57


$findMatchingParent

$findMatchingParent(startingNode, findFn): LexicalNode | null

Parameters

NameType
startingNodeLexicalNode
findFn(node: LexicalNode) => boolean

Returns

LexicalNode | null

Defined in

lexical-utils/src/index.ts:152


$getNearestBlockElementAncestorOrThrow

$getNearestBlockElementAncestorOrThrow(startNode): ElementNode

Parameters

NameType
startNodeLexicalNode

Returns

ElementNode

Defined in

lexical-utils/src/index.ts:126


$getNearestNodeOfType

$getNearestNodeOfType<T>(node, klass): T | null

Type parameters

NameType
Textends ElementNode<T>

Parameters

NameType
nodeLexicalNode
klassKlass<T>

Returns

T | null

Defined in

lexical-utils/src/index.ts:109


$insertBlockNode

$insertBlockNode<T>(node): T

Type parameters

NameType
Textends LexicalNode<T>

Parameters

NameType
nodeT

Returns

T

Defined in

lexical-utils/src/index.ts:413


$restoreEditorState

$restoreEditorState(editor, editorState): void

Parameters

NameType
editorLexicalEditor
editorStateEditorState

Returns

void

Defined in

lexical-utils/src/index.ts:396


addClassNamesToElement

addClassNamesToElement(element, ...classNames): void

Parameters

NameType
elementHTMLElement
...classNames(undefined | null | string | boolean)[]

Returns

void

Defined in

lexical-utils/src/index.ts:35


mergeRegister

mergeRegister(...func): () => void

Parameters

NameType
...funcFunc[]

Returns

fn

▸ (): void

Returns

void

Defined in

lexical-utils/src/index.ts:171


registerNestedElementResolver

registerNestedElementResolver<N>(editor, targetNode, cloneNode, handleOverlap): () => void

Type parameters

NameType
Nextends ElementNode<N>

Parameters

NameType
editorLexicalEditor
targetNodeKlass<N>
cloneNode(from: N) => N
handleOverlap(from: N, to: N) => void

Returns

fn

▸ (): void

Returns

void

Defined in

lexical-utils/src/index.ts:177


removeClassNamesFromElement

removeClassNamesFromElement(element, ...classNames): void

Parameters

NameType
elementHTMLElement
...classNames(undefined | null | string | boolean)[]

Returns

void

Defined in

lexical-utils/src/index.ts:46


unstable_convertLegacyJSONEditorState

unstable_convertLegacyJSONEditorState(editor, maybeStringifiedEditorState): EditorState

Parameters

NameType
editorLexicalEditor
maybeStringifiedEditorStatestring

Returns

EditorState

Defined in

lexical-utils/src/index.ts:385