import { Editor } from '@tiptap/react'; import { SelectedImageData } from '../types'; /** * Reads the image node at the current selection/cursor position and extracts * the src, alt, and alignment attributes. * * Returns null when: * - The cursor is not on an image node * - The image node is not the currently active/selected node * * IMPORTANT: Uses editor.isActive('image') to ensure the image node itself is selected, * not just present in the selection range. This prevents the bubble menu from showing * when the cursor is merely near an image—it only shows when the image is actively selected. * * @param editor - The live TipTap editor instance. * @returns An object with `src`, `alt`, and `alignment`, or null if no image is selected. */ export default function getSelectedImage(editor: Editor): SelectedImageData | null;