Type Editor / @type-editor/menu / menu-items/link-item / linkItem
Function: linkItem()
ts
function linkItem(title?, linkMarkType?, codeBlockNodeType?): MenuItem;Defined in: packages/menu/src/menu-items/link-item.ts:64
Creates a menu item for adding, editing, or removing links in the editor.
This function returns a MenuItem that opens a dialog allowing users to:
- Add a new link to selected text
- Edit an existing link's URL or target
- Remove an existing link
- Open an existing link in a new window
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
title | string | 'Link' | The display title for the menu item (default: 'Link') |
linkMarkType | MarkType | schema.marks.link | The mark type used for links (default: schema.marks.link) |
codeBlockNodeType | NodeType | schema.nodes.code_block | used to identify code blocks where link editing is disabled (default: schema.nodes.code_block) |
Returns
A configured MenuItem for link operations
Example
typescript
const linkMenuItem = linkItem("Insert Link", schema.marks.link);