Module: @lexical/link
Classes
Type Aliases
AutoLinkAttributes
Ƭ AutoLinkAttributes: Partial
<Spread
<LinkAttributes
, { isUnlinked?
: boolean
}>>
Defined in
packages/lexical-link/src/index.ts:46
LinkAttributes
Ƭ LinkAttributes: Object
Type declaration
Name | Type |
---|---|
rel? | null | string |
target? | null | string |
title? | null | string |
Defined in
packages/lexical-link/src/index.ts:40
SerializedAutoLinkNode
Ƭ SerializedAutoLinkNode: Spread
<{ isUnlinked
: boolean
}, SerializedLinkNode
>
Defined in
packages/lexical-link/src/index.ts:336
SerializedLinkNode
Ƭ SerializedLinkNode: Spread
<{ url
: string
}, Spread
<LinkAttributes
, SerializedElementNode
>>
Defined in
packages/lexical-link/src/index.ts:50
Variables
TOGGLE_LINK_COMMAND
• Const
TOGGLE_LINK_COMMAND: LexicalCommand
<string
| { url
: string
} & LinkAttributes
| null
>
Defined in
packages/lexical-link/src/index.ts:476
Functions
$createAutoLinkNode
▸ $createAutoLinkNode(url
, attributes?
): AutoLinkNode
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
Name | Type | Description |
---|---|---|
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.
Defined in
packages/lexical-link/src/index.ts:458
$createLinkNode
▸ $createLinkNode(url
, attributes?
): LinkNode
Takes a URL and creates a LinkNode.
Parameters
Name | Type | Description |
---|---|---|
url | string | The URL the LinkNode should direct to. |
attributes? | LinkAttributes | Optional HTML a tag attributes { target, rel, title } |
Returns
The LinkNode.
Defined in
packages/lexical-link/src/index.ts:318
$isAutoLinkNode
▸ $isAutoLinkNode(node
): node is AutoLinkNode
Determines if node is an AutoLinkNode.
Parameters
Name | Type | Description |
---|---|---|
node | undefined | null | LexicalNode | The node to be checked. |
Returns
node is AutoLinkNode
true if node is an AutoLinkNode, false otherwise.
Defined in
packages/lexical-link/src/index.ts:470
$isLinkNode
▸ $isLinkNode(node
): node is LinkNode
Determines if node is a LinkNode.
Parameters
Name | Type | Description |
---|---|---|
node | undefined | null | LexicalNode | The node to be checked. |
Returns
node is LinkNode
true if node is a LinkNode, false otherwise.
Defined in
packages/lexical-link/src/index.ts:330
$toggleLink
▸ $toggleLink(url
, attributes?
): void
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
Name | Type | Description |
---|---|---|
url | null | string | The URL the link directs to. |
attributes | LinkAttributes | Optional HTML a tag attributes. { target, rel, title } |
Returns
void
Defined in
packages/lexical-link/src/index.ts:546
toggleLink
▸ toggleLink(url
, attributes?
): void
Parameters
Name | Type |
---|---|
url | null | string |
attributes | LinkAttributes |
Returns
void
Deprecated
renamed to $toggleLink by @lexical/eslint-plugin rules-of-lexical