Skip to main content

@lexical/react/useLexicalTextEntity

Functions

useLexicalTextEntity()

useLexicalTextEntity<T>(getMatch, targetNode, createNode): void

Defined in: packages/lexical-react/src/useLexicalTextEntity.ts:24

Registers a text entity on the current editor: text matched by getMatch is automatically wrapped in instances of targetNode (created via createNode) and unwrapped when it no longer matches. This is the React wrapper around registerLexicalTextEntity and is the basis for features such as hashtags and mentions.

Type Parameters

T

T extends TextNode

Parameters

getMatch

(text) => EntityMatch | null

targetNode

Klass<T>

createNode

(textNode) => T

Returns

void