import { Editor } from '@tiptap/react'; import { ActiveLinkData } from '../types'; /** * Reads the link mark at the current selection/cursor position and extracts * the URL (href) and display text. * * This implementation correctly handles: * - Links that span multiple text nodes * - Links with nested structures * - Links at any position in the document * * Returns null when: * - The cursor is not on a link mark * - The selection does not contain a link * * @param editor - The live TipTap editor instance. * @returns An object with `url` and `text`, or null if no link is active. */ export default function getActiveLink(editor: Editor): ActiveLinkData | null;