@lexical/link
Classes
AutoLinkNode
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:461
Extends
Constructors
Constructor
new AutoLinkNode(
url?,attributes?,key?):AutoLinkNode
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:466
Parameters
url?
string = ''
attributes?
AutoLinkAttributes = {}
key?
string
Returns
Overrides
Properties
__isUnlinked
__isUnlinked:
boolean
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:464
Indicates whether the autolink was ever unlinked. *
Methods
$config()
$config():
BaseStaticNodeConfig&object&StaticNodeTypeAccessor<"link"> &object&StaticNodeTypeAccessor<"autolink">
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:483
Override this to implement the new static node configuration protocol, this method is called directly on the prototype and must not depend on anything initialized in the constructor. Generally it should be a trivial implementation.
Returns
BaseStaticNodeConfig & object & StaticNodeTypeAccessor<"link"> & object & StaticNodeTypeAccessor<"autolink">
Example
class MyNode extends TextNode {
$config() {
return this.config('my-node', {extends: TextNode});
}
}
Overrides
afterCloneFrom()
afterCloneFrom(
prevNode):void
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:478
Perform any state updates on the clone of prevNode that are not already
handled by the constructor call in the static clone method. If you have
state to update in your clone that is not handled directly by the
constructor, it is advisable to override this method but it is required
to include a call to super.afterCloneFrom(prevNode) in your
implementation. This is only intended to be called by
$cloneWithProperties function or via a super call.
Parameters
prevNode
this
Returns
void
Example
class ClassesTextNode extends TextNode {
// Not shown: static getType, static importJSON, exportJSON, createDOM, updateDOM
__classes = new Set<string>();
static clone(node: ClassesTextNode): ClassesTextNode {
// The inherited TextNode constructor is used here, so
// classes is not set by this method.
return new ClassesTextNode(node.__text, node.__key);
}
afterCloneFrom(node: this): void {
// This calls TextNode.afterCloneFrom and LexicalNode.afterCloneFrom
// for necessary state updates
super.afterCloneFrom(node);
this.__addClasses(node.__classes);
}
// This method is a private implementation detail, it is not
// suitable for the public API because it does not call getWritable
__addClasses(classNames: Iterable<string>): this {
for (const className of classNames) {
this.__classes.add(className);
}
return this;
}
addClass(...classNames: string[]): this {
return this.getWritable().__addClasses(classNames);
}
removeClass(...classNames: string[]): this {
const node = this.getWritable();
for (const className of classNames) {
this.__classes.delete(className);
}
return this;
}
getClasses(): Set<string> {
return this.getLatest().__classes;
}
}
Overrides
canBeEmpty()
canBeEmpty():
boolean
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:251
Returns
boolean
Inherited from
canInsertTextAfter()
canInsertTextAfter():
false
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:247
Returns
false
Inherited from
canInsertTextBefore()
canInsertTextBefore():
false
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:243
Returns
false
Inherited from
createDOM()
createDOM(
config):LinkHTMLElementType
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:501
Called during the reconciliation process to determine which nodes to insert into the DOM for this Lexical Node.
This method must return exactly one HTMLElement. Nested elements are not supported.
Do not attempt to update the Lexical EditorState during this phase of the update lifecycle.
Parameters
config
Returns
LinkHTMLElementType
Overrides
exportJSON()
exportJSON():
SerializedAutoLinkNode
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:528
Controls how the this node is serialized to JSON. This is important for copy and paste between Lexical editors sharing the same namespace. It's also important if you're serializing to JSON for persistent storage somewhere. See Serialization & Deserialization.
Returns
Overrides
extractWithChild()
extractWithChild(
child,selection,destination):boolean
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:259
Parameters
child
selection
destination
"clone" | "html"
Returns
boolean
Inherited from
getIsUnlinked()
getIsUnlinked():
boolean
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:491
Returns
boolean
getRel()
getRel():
string|null
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:214
Returns
string | null
Inherited from
getTarget()
getTarget():
string|null
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:204
Returns
string | null
Inherited from
getTitle()
getTitle():
string|null
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:224
Returns
string | null
Inherited from
getURL()
getURL():
string
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:194
Returns
string
Inherited from
insertNewAfter()
insertNewAfter(
_,restoreSelection?):ElementNode|null
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:535
Parameters
_
restoreSelection?
boolean = true
Returns
ElementNode | null
Overrides
isEmailURI()
isEmailURI():
boolean
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:278
Returns
boolean
Inherited from
isInline()
isInline():
true
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:255
If the method is overridden and returns true, ensure that canBeEmpty()
returns false for the inline node to work correctly
Returns
true
Inherited from
isWebSiteURI()
isWebSiteURI():
boolean
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:282
Returns
boolean
Inherited from
sanitizeUrl()
sanitizeUrl(
url):string
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:170
Parameters
url
string
Returns
string
Inherited from
setIsUnlinked()
setIsUnlinked(
value):this
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:495
Parameters
value
boolean
Returns
this
setRel()
setRel(
rel):this
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:218
Parameters
rel
string | null
Returns
this
Inherited from
setTarget()
setTarget(
target):this
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:208
Parameters
target
string | null
Returns
this
Inherited from
setTitle()
setTitle(
title):this
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:228
Parameters
title
string | null
Returns
this
Inherited from
setURL()
setURL(
url):this
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:198
Parameters
url
string
Returns
this
Inherited from
shouldMergeAdjacentLink()
shouldMergeAdjacentLink(
_otherLink):boolean
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:487
Parameters
_otherLink
Returns
boolean
Overrides
LinkNode.shouldMergeAdjacentLink
updateDOM()
updateDOM(
prevNode,anchor,config):boolean
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:509
Called when a node changes and should update the DOM in whatever way is necessary to make it align with any changes that might have happened during the update.
Returning "true" here will cause lexical to unmount and recreate the DOM node (by calling createDOM). You would need to do this if the element tag changes, for instance.
Parameters
prevNode
this
anchor
LinkHTMLElementType
config
Returns
boolean
Overrides
updateFromJSON()
updateFromJSON(
serializedNode):this
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:520
Update this LexicalNode instance from serialized JSON. It's recommended to implement as much logic as possible in this method instead of the static importJSON method, so that the functionality can be inherited in subclasses.
The LexicalUpdateJSON utility type should be used to ignore any type, version, or children properties in the JSON so that the extended JSON from subclasses are acceptable parameters for the super call.
If overridden, this method must call super.
Parameters
serializedNode
LexicalUpdateJSON<SerializedAutoLinkNode>
Returns
this
Example
class MyTextNode extends TextNode {
// ...
static importJSON(serializedNode: SerializedMyTextNode): MyTextNode {
return $createMyTextNode()
.updateFromJSON(serializedNode);
}
updateFromJSON(
serializedNode: LexicalUpdateJSON<SerializedMyTextNode>,
): this {
return super.updateFromJSON(serializedNode)
.setMyProperty(serializedNode.myProperty);
}
}
Overrides
updateLinkDOM()
updateLinkDOM(
prevNode,anchor,config):void
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:129
Parameters
prevNode
AutoLinkNode | null
anchor
LinkHTMLElementType
config
Returns
void
Inherited from
LinkNode
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:79
Extends
Extended by
Constructors
Constructor
new LinkNode(
url?,attributes?,key?):LinkNode
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:101
Parameters
url?
string = ''
attributes?
LinkAttributes = {}
key?
string
Returns
Overrides
Methods
$config()
$config():
BaseStaticNodeConfig&object&StaticNodeTypeAccessor<"link">
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:89
Override this to implement the new static node configuration protocol, this method is called directly on the prototype and must not depend on anything initialized in the constructor. Generally it should be a trivial implementation.
Returns
BaseStaticNodeConfig & object & StaticNodeTypeAccessor<"link">
Example
class MyNode extends TextNode {
$config() {
return this.config('my-node', {extends: TextNode});
}
}
Overrides
afterCloneFrom()
afterCloneFrom(
prevNode):void
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:114
Perform any state updates on the clone of prevNode that are not already
handled by the constructor call in the static clone method. If you have
state to update in your clone that is not handled directly by the
constructor, it is advisable to override this method but it is required
to include a call to super.afterCloneFrom(prevNode) in your
implementation. This is only intended to be called by
$cloneWithProperties function or via a super call.
Parameters
prevNode
this
Returns
void
Example
class ClassesTextNode extends TextNode {
// Not shown: static getType, static importJSON, exportJSON, createDOM, updateDOM
__classes = new Set<string>();
static clone(node: ClassesTextNode): ClassesTextNode {
// The inherited TextNode constructor is used here, so
// classes is not set by this method.
return new ClassesTextNode(node.__text, node.__key);
}
afterCloneFrom(node: this): void {
// This calls TextNode.afterCloneFrom and LexicalNode.afterCloneFrom
// for necessary state updates
super.afterCloneFrom(node);
this.__addClasses(node.__classes);
}
// This method is a private implementation detail, it is not
// suitable for the public API because it does not call getWritable
__addClasses(classNames: Iterable<string>): this {
for (const className of classNames) {
this.__classes.add(className);
}
return this;
}
addClass(...classNames: string[]): this {
return this.getWritable().__addClasses(classNames);
}
removeClass(...classNames: string[]): this {
const node = this.getWritable();
for (const className of classNames) {
this.__classes.delete(className);
}
return this;
}
getClasses(): Set<string> {
return this.getLatest().__classes;
}
}
Overrides
canBeEmpty()
canBeEmpty():
boolean
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:251
Returns
boolean
Overrides
canInsertTextAfter()
canInsertTextAfter():
false
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:247
Returns
false
Overrides
ElementNode.canInsertTextAfter
canInsertTextBefore()
canInsertTextBefore():
false
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:243
Returns
false
Overrides
ElementNode.canInsertTextBefore
createDOM()
createDOM(
config):LinkHTMLElementType
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:122
Called during the reconciliation process to determine which nodes to insert into the DOM for this Lexical Node.
This method must return exactly one HTMLElement. Nested elements are not supported.
Do not attempt to update the Lexical EditorState during this phase of the update lifecycle.
Parameters
config
Returns
LinkHTMLElementType
Overrides
exportJSON()
exportJSON():
SerializedLinkNode|SerializedAutoLinkNode
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:184
Controls how the this node is serialized to JSON. This is important for copy and paste between Lexical editors sharing the same namespace. It's also important if you're serializing to JSON for persistent storage somewhere. See Serialization & Deserialization.
Returns
SerializedLinkNode | SerializedAutoLinkNode
Overrides
extractWithChild()
extractWithChild(
child,selection,destination):boolean
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:259
Parameters
child
selection
destination
"clone" | "html"
Returns
boolean
Overrides
getRel()
getRel():
string|null
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:214
Returns
string | null
getTarget()
getTarget():
string|null
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:204
Returns
string | null
getTitle()
getTitle():
string|null
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:224
Returns
string | null
getURL()
getURL():
string
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:194
Returns
string
insertNewAfter()
insertNewAfter(
_,restoreSelection?):ElementNode|null
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:234
Parameters
_
restoreSelection?
boolean = true
Returns
ElementNode | null
Overrides
isEmailURI()
isEmailURI():
boolean
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:278
Returns
boolean
isInline()
isInline():
true
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:255
If the method is overridden and returns true, ensure that canBeEmpty()
returns false for the inline node to work correctly
Returns
true
Overrides
isWebSiteURI()
isWebSiteURI():
boolean
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:282
Returns
boolean
sanitizeUrl()
sanitizeUrl(
url):string
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:170
Parameters
url
string
Returns
string
setRel()
setRel(
rel):this
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:218
Parameters
rel
string | null
Returns
this
setTarget()
setTarget(
target):this
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:208
Parameters
target
string | null
Returns
this
setTitle()
setTitle(
title):this
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:228
Parameters
title
string | null
Returns
this
setURL()
setURL(
url):this
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:198
Parameters
url
string
Returns
this
shouldMergeAdjacentLink()
shouldMergeAdjacentLink(
otherLink):boolean
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:288
Parameters
otherLink
Returns
boolean
updateDOM()
updateDOM(
prevNode,anchor,config):boolean
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:152
Called when a node changes and should update the DOM in whatever way is necessary to make it align with any changes that might have happened during the update.
Returning "true" here will cause lexical to unmount and recreate the DOM node (by calling createDOM). You would need to do this if the element tag changes, for instance.
Parameters
prevNode
this
anchor
LinkHTMLElementType
config
Returns
boolean
Overrides
updateFromJSON()
updateFromJSON(
serializedNode):this
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:161
Update this LexicalNode instance from serialized JSON. It's recommended to implement as much logic as possible in this method instead of the static importJSON method, so that the functionality can be inherited in subclasses.
The LexicalUpdateJSON utility type should be used to ignore any type, version, or children properties in the JSON so that the extended JSON from subclasses are acceptable parameters for the super call.
If overridden, this method must call super.
Parameters
serializedNode
LexicalUpdateJSON<SerializedLinkNode>
Returns
this
Example
class MyTextNode extends TextNode {
// ...
static importJSON(serializedNode: SerializedMyTextNode): MyTextNode {
return $createMyTextNode()
.updateFromJSON(serializedNode);
}
updateFromJSON(
serializedNode: LexicalUpdateJSON<SerializedMyTextNode>,
): this {
return super.updateFromJSON(serializedNode)
.setMyProperty(serializedNode.myProperty);
}
}
Overrides
updateLinkDOM()
updateLinkDOM(
prevNode,anchor,config):void
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:129
Parameters
prevNode
LinkNode | null
anchor
LinkHTMLElementType
config
Returns
void
Interfaces
AutoLinkConfig
Defined in: packages/lexical-link/src/LexicalAutoLinkExtension.ts:525
Properties
changeHandlers
changeHandlers:
ChangeHandler[]
Defined in: packages/lexical-link/src/LexicalAutoLinkExtension.ts:526
excludeParents
excludeParents: (
parent) =>boolean[]
Defined in: packages/lexical-link/src/LexicalAutoLinkExtension.ts:527
Parameters
parent
Returns
boolean
matchers
matchers:
LinkMatcher[]
Defined in: packages/lexical-link/src/LexicalAutoLinkExtension.ts:528
separatorRegex
separatorRegex:
RegExp
Defined in: packages/lexical-link/src/LexicalAutoLinkExtension.ts:534
The regular expression used to determine whether surrounding
characters count as separators when validating auto-link
boundaries. Defaults to /[.,;\s]/.
ClickableLinkConfig
Defined in: packages/lexical-link/src/ClickableLinkExtension.ts:40
Properties
disabled
disabled:
boolean
Defined in: packages/lexical-link/src/ClickableLinkExtension.ts:44
Disable this extension when true (default false)
newTab
newTab:
boolean
Defined in: packages/lexical-link/src/ClickableLinkExtension.ts:42
Open clicked links in a new tab when true (default false)
Type Aliases
AutoLinkAttributes
AutoLinkAttributes =
Partial<Spread<LinkAttributes, {isUnlinked?:boolean; }>>
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:57
ChangeHandler
ChangeHandler = (
url,prevUrl) =>void
Defined in: packages/lexical-link/src/LexicalAutoLinkExtension.ts:36
Parameters
url
string | null
prevUrl
string | null
Returns
void
LinkAttributes
LinkAttributes =
object
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:51
Properties
rel?
optionalrel?:null|string
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:52
target?
optionaltarget?:null|string
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:53
title?
optionaltitle?:null|string
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:54
LinkMatcher
LinkMatcher = (
text) =>LinkMatcherResult|null
Defined in: packages/lexical-link/src/LexicalAutoLinkExtension.ts:49
Parameters
text
string
Returns
LinkMatcherResult | null
SerializedAutoLinkNode
SerializedAutoLinkNode =
Spread<{isUnlinked:boolean; },SerializedLinkNode>
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:452
SerializedLinkNode
SerializedLinkNode =
Spread<{url:string; },Spread<LinkAttributes,SerializedElementNode>>
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:61
Variables
AutoLinkExtension
constAutoLinkExtension:LexicalExtension<AutoLinkConfig,"@lexical/link/AutoLink",unknown,unknown>
Defined in: packages/lexical-link/src/LexicalAutoLinkExtension.ts:623
An extension to automatically create AutoLinkNode from text that matches the configured matchers. No default implementation is provided for any matcher, see createLinkMatcherWithRegExp for a helper function to create a matcher from a RegExp, and the Playground's AutoLinkPlugin for some example RegExps that could be used.
The given matchers and changeHandlers will be merged by
concatenating the configured arrays.
ClickableLinkExtension
constClickableLinkExtension:LexicalExtension<ClickableLinkConfig,"@lexical/link/ClickableLink",NamedSignalsOutput<ClickableLinkConfig>,unknown>
Defined in: packages/lexical-link/src/ClickableLinkExtension.ts:132
Normally in a Lexical editor the CLICK_COMMAND on a LinkNode will cause the
selection to change instead of opening a link. This extension can be used to
restore the default behavior, e.g. when the editor is not editable.
LinkExtension
constLinkExtension:LexicalExtension<LinkConfig,"@lexical/link/Link",NamedSignalsOutput<LinkConfig>,unknown>
Defined in: packages/lexical-link/src/LexicalLinkExtension.ts:144
Provides LinkNode, an implementation of
TOGGLE_LINK_COMMAND, and a PASTE_COMMAND
listener to wrap selected nodes in a link when a
URL is pasted and validateUrl is defined.
LinkImportExtension
constLinkImportExtension:LexicalExtension<ExtensionConfigBase,"@lexical/link/Import",unknown,unknown>
Defined in: packages/lexical-link/src/LinkImportExtension.ts:61
Experimental
Bundles LinkImportRules together with the runtime
LinkExtension. The application is expected to already have
CoreImportExtension (or some equivalent) in its dependency graph —
the core/text/paragraph/inline-format rules are a shared baseline,
not something this leaf importer should re-declare.
LinkImportRules
constLinkImportRules:DOMImportRule<ElementSelectorBuilder<HTMLAnchorElement,Record<string,never>>>[]
Defined in: packages/lexical-link/src/LinkImportExtension.ts:50
Experimental
Import rules for LinkNode.
TOGGLE_LINK_COMMAND
constTOGGLE_LINK_COMMAND:LexicalCommand<string|object&LinkAttributes|null>
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:575
toggleLink
consttoggleLink: (urlOrAttributes,attributes) =>void=$toggleLink
Defined in: packages/lexical-link/src/index.ts:43
Generates or updates a LinkNode. It can also delete a LinkNode if the URL is null, but saves any children and brings them up to the parent node.
Parameters
urlOrAttributes
string | LinkAttributes & object | null
The URL the link directs to, or an attributes object with an url property
attributes?
LinkAttributes = {}
Optional HTML a tag attributes. { target, rel, title }
Returns
void
Deprecated
renamed to $toggleLink by @lexical/eslint-plugin rules-of-lexical
Functions
$createAutoLinkNode()
$createAutoLinkNode(
url?,attributes?):AutoLinkNode
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:557
Takes a URL and creates an AutoLinkNode. AutoLinkNodes are generally automatically generated during typing, which is especially useful when a button to generate a LinkNode is not practical.
Parameters
url?
string = ''
The URL the LinkNode should direct to.
attributes?
Partial<Spread<LinkAttributes, { isUnlinked?: boolean; }>>
Optional HTML a tag attributes. { target, rel, title }
Returns
The LinkNode.
$createLinkNode()
$createLinkNode(
url?,attributes?):LinkNode
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:434
Takes a URL and creates a LinkNode.
Parameters
url?
string = ''
The URL the LinkNode should direct to.
attributes?
Optional HTML a tag attributes { target, rel, title }
Returns
The LinkNode.
$isAutoLinkNode()
$isAutoLinkNode(
node):node is AutoLinkNode
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:569
Determines if node is an AutoLinkNode.
Parameters
node
LexicalNode | null | undefined
The node to be checked.
Returns
node is AutoLinkNode
true if node is an AutoLinkNode, false otherwise.
$isLinkNode()
$isLinkNode(
node):node is LinkNode
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:446
Determines if node is a LinkNode.
Parameters
node
LexicalNode | null | undefined
The node to be checked.
Returns
node is LinkNode
true if node is a LinkNode, false otherwise.
$toggleLink()
$toggleLink(
urlOrAttributes,attributes?):void
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:704
Generates or updates a LinkNode. It can also delete a LinkNode if the URL is null, but saves any children and brings them up to the parent node.
Parameters
urlOrAttributes
string | LinkAttributes & object | null
The URL the link directs to, or an attributes object with an url property
attributes?
LinkAttributes = {}
Optional HTML a tag attributes. { target, rel, title }
Returns
void
createLinkMatcherWithRegExp()
createLinkMatcherWithRegExp(
regExp,urlTransformer?): (text) => {index:number;length:number;text:string;url:string; } |null
Defined in: packages/lexical-link/src/LexicalAutoLinkExtension.ts:51
Parameters
regExp
RegExp
urlTransformer?
(text) => string
Returns
(text) => { index: number; length: number; text: string; url: string; } | null
formatUrl()
formatUrl(
url):string
Defined in: packages/lexical-link/src/LexicalLinkNode.ts:904
Formats a URL string by adding appropriate protocol if missing
Parameters
url
string
URL to format
Returns
string
Formatted URL with appropriate protocol
registerAutoLink()
registerAutoLink(
editor,config?): () =>void
Defined in: packages/lexical-link/src/LexicalAutoLinkExtension.ts:544
Parameters
editor
config?
Partial<AutoLinkConfig> & Omit<AutoLinkConfig, "separatorRegex"> = defaultConfig
Returns
() => void
registerClickableLink()
registerClickableLink(
editor,stores,eventOptions?): () =>void
Defined in: packages/lexical-link/src/ClickableLinkExtension.ts:47
Parameters
editor
stores
NamedSignalsOutput<ClickableLinkConfig>
eventOptions?
Pick<AddEventListenerOptions, "signal"> = {}
Returns
() => void