import { WhatsappBlock, WhatsappMarker } from './whatsapp-markup'; import { WhatsappEditorOptions } from './whatsapp-editor.types'; /** * Headless WhatsApp message editor. Enhances a ` * *
* * ``` */ export declare class WhatsappEditor { private readonly root; private readonly input; private readonly toolbar; private readonly buttons; private readonly floating; private readonly trigger; private readonly picker; private readonly counter; private readonly preview; private readonly maxLength; private injectedFloating; private cleanups; constructor(root: HTMLElement, options?: WhatsappEditorOptions); private init; private listen; /** Recompute preview + counter and emit a change event. */ private sync; /** Whether the floating selection toolbar is currently shown. */ isFloatingOpen(): boolean; /** * Driven by `selectionchange`: show + position the floating toolbar while a * non-empty selection lives in the textarea, hide it otherwise, and keep the * toolbar buttons' active states in sync. */ private updateSelectionUI; private showFloating; private hideFloating; /** * Position the floating toolbar centered above the selection. Coordinates come * from the mirror-div caret helper, offset by the textarea's position within * the (relatively positioned) root and its scroll. CSS owns the final upward * shift via `transform`, so this only sets `left`/`top` in pixels. */ private positionFloating; /** * Reflect whether the current selection is wrapped by each inline marker on * every command button (toolbar + floating) via `aria-pressed` + `data-active` * so styles can highlight the active state. */ private refreshActiveStates; isPickerOpen(): boolean; togglePicker(): void; openPicker(): void; closePicker(): void; /** Insert text (e.g. an emoji) at the caret, respecting maxLength. */ insertText(text: string): void; /** Toggle an inline marker around the current selection. */ format(marker: WhatsappMarker): void; /** * Toggle a line-prefix block (blockquote / bullet / numbered list) across the * line(s) spanned by the current selection. */ applyBlock(kind: WhatsappBlock): void; /** * Remove all WhatsApp formatting (inline markers + line-prefix blocks) from * the current selection, or from the whole message when nothing is selected. */ clearFormatting(): void; /** Current WhatsApp markup (what you send). */ getText(): string; /** Current preview HTML (safe, escaped). */ getHTML(): string; get value(): string; set value(v: string); /** Focus the textarea. */ focus(): void; /** Subscribe to a DOM event on the root element. Returns an unsubscribe fn. */ on(event: string, handler: (event: E) => void): () => void; destroy(): void; }