import { default as HtmlEditorMode } from '../types/HtmlEditorMode'; import { UseHtmlEditorProps, SelectedTableData, ActiveLinkData, SelectedImageData, HandleToolbarAction, SelectedVideoData } from '../types'; /** * Owns all editor state, the TipTap instance, and the toolbar action dispatcher. * * Responsibilities: * - Initialises the TipTap editor with the correct extension set. * - Keeps 6 toolbar-state slices in sync via a single {@link getToolbarSnapshot} call. * - Dispatches every toolbar action string to the matching TipTap command. * - Manages the visual / code mode toggle. * * @param props - See {@link UseHtmlEditorProps}. * @returns Everything the HtmlEditor render shell needs. */ export default function useHtmlEditor({ initialContent, onContentChange, initialMode, colorPalette }: UseHtmlEditorProps): { editor: import('@tiptap/core').Editor | null; mode: HtmlEditorMode; handleModeChange: (newMode: HtmlEditorMode) => void; handleToolbarAction: HandleToolbarAction; showImagePasteWarning: boolean; imagePopoverOpen: boolean; handleImagePopoverClose: () => void; handleCodeChange: (html: string) => void; activeActions: string[]; selectedStyle: string; selectedFontSize: number | undefined; selectedTextColor: string | undefined; selectedBgColor: string | undefined; selectedAlignment: string; colorPalette: string[] | undefined; selectedLink: ActiveLinkData | null; selectedText: string; selectedImage: SelectedImageData | null; selectedVideo: SelectedVideoData | null; selectedTable: SelectedTableData | null; searchTerm: string; searchResults: number; searchResultIndex: number; };