Link extension for tiptap rich text editor providing automatic link detection, paste handling, click behavior, and XSS protection.
88
Build a simple rich text editor toolbar component that allows users to add, edit, and remove hyperlinks from selected text.
Your toolbar should provide the following functionality:
window.prompt() for simplicitytarget="_blank" and rel="noopener noreferrer" attributes when appropriate@generates
/**
* Adds a link to the currently selected text
*/
export function addLink(editor: any): void;
/**
* Edits the URL of an existing link at the cursor position
*/
export function editLink(editor: any): void;
/**
* Removes link formatting from the text at the cursor position
*/
export function removeLink(editor: any): void;
/**
* Toggles link formatting on/off for selected text or at cursor
*/
export function toggleLinkFormat(editor: any): void;addLink with selected text "example" and URL "https://example.com" creates a clickable link @testremoveLink when cursor is within a link removes the link but preserves the text @testtoggleLinkFormat on linked text removes the link @testtoggleLinkFormat on unlinked selected text adds a link @testProvides link functionality for the rich text editor.
Install with Tessl CLI
npx tessl i tessl/npm-tiptap--extension-linkdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10