import { type ReactNode, type RefObject } from 'react'; import type { RichTextEditorAiTemplate, RichTextEditorVariable } from './rich-text-editor'; export type EditorToolbarPreset = 'minimal' | 'standard' | 'full'; export interface EditorToolbarProps { /** Dispatch a Redactor command (and refresh active state). */ run: (command: string, ...args: unknown[]) => void; /** Active formats at the caret — toggle buttons render pressed. */ active: ReadonlySet; preset: EditorToolbarPreset; /** Insert sanitised HTML at the caret (link / image / table). */ insertHtml: (html: string) => void; /** Insert a table — list-aware (drops it after a list, never inside an
  • ). */ insertTable: (html: string) => void; /** Save the editor selection before a DS popover/dialog takes focus. */ saveSelection: () => void; /** Restore the saved selection before applying. */ restoreSelection: () => void; /** Current selected text — prefills the link dialog's text field. */ getSelectedText: () => string; /** Upload an image file and resolve its URL (image dialog's upload area). */ uploadImage?: (file: File, signal?: AbortSignal) => Promise; /** Show the text-colour control. */ enableColor?: boolean; /** Show the image control (consumer set an image-upload URL). */ enableImage?: boolean; /** Show the table control (consumer loaded the table plugin). */ enableTable?: boolean; /** * Show an "Editor extensions" tools affordance (marketplace tools), placed * inline at the end of the toolbar. Currently a visual placeholder — not * wired to a menu. */ showExtensions?: boolean; extensionControl?: ReactNode; /** Template variables for the "Insert variable" menu (hidden when empty). */ variables?: RichTextEditorVariable[]; /** Most-recently-used tokens, most recent first — rendered as the menu's * "Recent" group (max 3). Forwarded from `RichTextEditor`. */ recentVariableTokens?: string[]; /** Insert a variable chip at the saved caret. */ insertVariable?: (token: string) => void; } export interface TableFloatingToolbarProps { active: ReadonlySet; run: EditorToolbarProps['run']; /** Positioned container the bar is absolutely placed within. */ areaRef: RefObject; /** The the caret is currently inside (relative to this editor). */ getActiveTableEl: () => HTMLElement | null; /** Show the cell/row background-colour controls (fontcolor plugin loaded). */ enableColor?: boolean; /** Snapshot the current cell before a colour popover takes focus. */ saveTableCell: () => void; /** Set/clear a background colour on the current cell or its row. */ applyTableBackground: (scope: 'cell' | 'row', colour: string | null) => void; } export declare function TableFloatingToolbar({ active, run, areaRef, getActiveTableEl, enableColor, saveTableCell, applyTableBackground, }: TableFloatingToolbarProps): React.JSX.Element | null; export declare const IMAGE_FLOW_CLASSES: readonly ["wysiwyg-img-inline", "wysiwyg-img-wrap-left", "wysiwyg-img-wrap-right"]; export declare const IMAGE_ALIGN_CLASSES: readonly ["wysiwyg-img-align-left", "wysiwyg-img-align-center", "wysiwyg-img-align-right"]; /** The layout class currently set within a group on `el` (or '' for none). */ export declare function selectedImageClass(el: HTMLElement, group: readonly string[]): string; /** The image's rendered width as a whole-percent of its editable box. */ export declare function imageWidthPercent(img: HTMLElement): number; export interface ImageFloatingToolbarProps { /** Positioned container the frame + bar are absolutely placed within. */ areaRef: RefObject; /** The currently selected in THIS editor, or null. */ activeImageEl: HTMLElement | null; /** Apply/replace a `wysiwyg-img-*` class within its group on the image. */ applyImageClass: (className: string) => void; /** Set the image width as a % of its editable box (clamped 10–100). */ setImageWidth: (pct: number) => void; } export declare function ImageFloatingToolbar({ areaRef, activeImageEl: img, applyImageClass, setImageWidth, }: ImageFloatingToolbarProps): React.JSX.Element | null; export interface AiTemplatesMenuProps { templates: RichTextEditorAiTemplate[]; onPick: (template: RichTextEditorAiTemplate) => void; /** Shows "Manage templates" / "Create your first template". */ onManage?: (mode: 'list' | 'create') => void; /** Nothing to rewrite: the run items disable, the library stays readable. */ noteEmpty: boolean; onOpenChange?: (open: boolean) => void; /** The trigger element (rendered `asChild`). */ trigger: ReactNode; /** The pill sits at the editor's bottom edge, so the menu opens upward. */ side?: 'top' | 'bottom'; } export declare function AiTemplatesMenu({ templates, onPick, onManage, noteEmpty, onOpenChange, trigger, side, }: AiTemplatesMenuProps): React.JSX.Element; export interface SelectionFloatingToolbarProps { active: ReadonlySet; run: EditorToolbarProps['run']; /** Positioned container the bubble is absolutely placed within. */ areaRef: RefObject; /** This editor's editable root (`.redactor-in`). */ getEditorRoot: () => Element | null; /** Hide it (an AI action runs, a panel is open). */ suppressed?: boolean; /** Keep it mounted while a menu opened from it is showing. */ holdOpen?: boolean; /** The AI actions, after the formats. */ children?: ReactNode; } export declare function SelectionFloatingToolbar({ active, run, areaRef, getEditorRoot, suppressed, holdOpen, children, }: SelectionFloatingToolbarProps): React.JSX.Element | null; export declare function EditorToolbar({ run, active, preset, insertHtml, insertTable, saveSelection, restoreSelection, getSelectedText, uploadImage, enableColor, enableImage, enableTable, showExtensions, extensionControl, variables, recentVariableTokens, insertVariable, }: EditorToolbarProps): React.JSX.Element; //# sourceMappingURL=editor-toolbar.d.ts.map