Skip to main content

Module: @lexical/link

Classes

Type Aliases

LinkAttributes

Ƭ LinkAttributes: Object

Type declaration

NameType
rel?null | string
target?null | string
title?null | string

Defined in

packages/lexical-link/src/index.ts:32


SerializedAutoLinkNode

Ƭ SerializedAutoLinkNode: SerializedLinkNode

Defined in

packages/lexical-link/src/index.ts:312


SerializedLinkNode

Ƭ SerializedLinkNode: Spread<{ url: string }, Spread<LinkAttributes, SerializedElementNode>>

Defined in

packages/lexical-link/src/index.ts:38

Variables

Const TOGGLE_LINK_COMMAND: LexicalCommand<string | { url: string } & LinkAttributes | null>

Defined in

packages/lexical-link/src/index.ts:400

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

NameTypeDescription
urlstringThe URL the LinkNode should direct to.
attributes?LinkAttributesOptional HTML a tag attributes. { target, rel, title }

Returns

AutoLinkNode

The LinkNode.

Defined in

packages/lexical-link/src/index.ts:382


$createLinkNode

$createLinkNode(url, attributes?): LinkNode

Takes a URL and creates a LinkNode.

Parameters

NameTypeDescription
urlstringThe URL the LinkNode should direct to.
attributes?LinkAttributesOptional HTML a tag attributes { target, rel, title }

Returns

LinkNode

The LinkNode.

Defined in

packages/lexical-link/src/index.ts:294


$isAutoLinkNode

$isAutoLinkNode(node): node is AutoLinkNode

Determines if node is an AutoLinkNode.

Parameters

NameTypeDescription
nodeundefined | null | LexicalNodeThe node to be checked.

Returns

node is AutoLinkNode

true if node is an AutoLinkNode, false otherwise.

Defined in

packages/lexical-link/src/index.ts:394


$isLinkNode

$isLinkNode(node): node is LinkNode

Determines if node is a LinkNode.

Parameters

NameTypeDescription
nodeundefined | null | LexicalNodeThe node to be checked.

Returns

node is LinkNode

true if node is a LinkNode, false otherwise.

Defined in

packages/lexical-link/src/index.ts:306


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

NameTypeDescription
urlnull | stringThe URL the link directs to.
attributesLinkAttributesOptional HTML a tag attributes. { target, rel, title }

Returns

void

Defined in

packages/lexical-link/src/index.ts:410