@lexical/react/LexicalAutoEmbedPluginUtils
Classes
AutoEmbedOption
Defined in: packages/lexical-react/src/LexicalAutoEmbedPluginUtils.ts:67
A MenuOption for the auto-embed menu, pairing a display title with
an onSelect callback invoked when the user chooses to embed the detected
URL.
Extends
Constructors
Constructor
new AutoEmbedOption(
title,options):AutoEmbedOption
Defined in: packages/lexical-react/src/LexicalAutoEmbedPluginUtils.ts:70
Parameters
title
string
options
onSelect
(targetNode) => void
Returns
Overrides
Properties
icon?
optionalicon?:Element
Defined in: packages/lexical-react/src/shared/LexicalMenu.tsx:77
Inherited from
key
key:
string
Defined in: packages/lexical-react/src/shared/LexicalMenu.tsx:75
Inherited from
onSelect
onSelect: (
targetNode) =>void
Defined in: packages/lexical-react/src/LexicalAutoEmbedPluginUtils.ts:69
Parameters
targetNode
LexicalNode | null
Returns
void
ref?
optionalref?:RefObject<HTMLElement|null>
Defined in: packages/lexical-react/src/shared/LexicalMenu.tsx:76
Inherited from
title
title:
string
Defined in: packages/lexical-react/src/LexicalAutoEmbedPluginUtils.ts:68
Overrides
Methods
setRefElement()
setRefElement(
element):void
Defined in: packages/lexical-react/src/shared/LexicalMenu.tsx:86
Parameters
element
HTMLElement | null
Returns
void
Inherited from
Interfaces
EmbedConfig
Defined in: packages/lexical-react/src/LexicalAutoEmbedPluginUtils.ts:34
Describes a kind of embed (for example YouTube, a tweet, or Google Maps) that
LexicalAutoEmbedPlugin can detect and insert. Each config has a type
identifier, a parseUrl function that decides whether a URL matches and
extracts its data, and an insertNode function that inserts the corresponding
Lexical node.
Type Parameters
TEmbedMatchResultData
TEmbedMatchResultData = unknown
TEmbedMatchResult
TEmbedMatchResult = EmbedMatchResult<TEmbedMatchResultData>
Properties
insertNode
insertNode: (
editor,result) =>void
Defined in: packages/lexical-react/src/LexicalAutoEmbedPluginUtils.ts:44
Parameters
editor
result
TEmbedMatchResult
Returns
void
parseUrl
parseUrl: (
text) =>TEmbedMatchResult|Promise<TEmbedMatchResult|null> |null
Defined in: packages/lexical-react/src/LexicalAutoEmbedPluginUtils.ts:40
Parameters
text
string
Returns
TEmbedMatchResult | Promise<TEmbedMatchResult | null> | null
type
type:
string
Defined in: packages/lexical-react/src/LexicalAutoEmbedPluginUtils.ts:38
Type Aliases
EmbedMatchResult
EmbedMatchResult<
TEmbedMatchResult> =object
Defined in: packages/lexical-react/src/LexicalAutoEmbedPluginUtils.ts:21
The result of matching a URL for an embed: the matched url, an id
identifying the embedded resource, and optional provider-specific data.
Type Parameters
TEmbedMatchResult
TEmbedMatchResult = unknown
Properties
data?
optionaldata?:TEmbedMatchResult
Defined in: packages/lexical-react/src/LexicalAutoEmbedPluginUtils.ts:24
id
id:
string
Defined in: packages/lexical-react/src/LexicalAutoEmbedPluginUtils.ts:23
url
url:
string
Defined in: packages/lexical-react/src/LexicalAutoEmbedPluginUtils.ts:22
Variables
INSERT_EMBED_COMMAND
constINSERT_EMBED_COMMAND:LexicalCommand<EmbedConfig["type"]>
Defined in: packages/lexical-react/src/LexicalAutoEmbedPluginUtils.ts:59
Command dispatched to start inserting an embed. Its payload is the type of
the EmbedConfig to use; LexicalAutoEmbedPlugin listens for it
and runs that config's URL detection flow.
URL_MATCHER
constURL_MATCHER:RegExp
Defined in: packages/lexical-react/src/LexicalAutoEmbedPluginUtils.ts:51
A general-purpose regular expression for detecting URLs, provided as a
convenience for implementing an EmbedConfig's parseUrl.