import { Editor } from '@tiptap/core'; import { type PageLayoutOptions, DEFAULT_PAGE_LAYOUT } from './extensions/PageLayout'; import { defaultSlashCommands, type SlashCommand } from './extensions/SlashCommands'; import { CommandManager } from './CommandManager'; import { type ExportFormat, type ExportOptions } from './ExportEngine'; import { StyleManager } from './StyleManager'; import { type PrintOptions } from './PrintEngine'; export type { ExportFormat, ExportOptions, SlashCommand, PageLayoutOptions, PrintOptions }; export { defaultSlashCommands, DEFAULT_PAGE_LAYOUT }; export { StyleManager } from './StyleManager'; export { ExportEngine } from './ExportEngine'; export { ImportEngine } from './ImportEngine'; export { PrintEngine } from './PrintEngine'; export { DocumentValidator } from './DocumentValidator'; export { CommandManager } from './CommandManager'; export type { ChangeRecord } from './extensions/TrackChanges'; export interface WordEditorOptions { element: HTMLElement; /** Initial document — HTML string or Tiptap JSON. */ initialContent?: string | Record; /** @deprecated Use `initialContent`. Kept for backwards compatibility. */ content?: string | Record; placeholder?: string; editable?: boolean; autofocus?: boolean | 'start' | 'end' | 'all' | number; pageLayout?: Partial; trackAuthor?: string; imageUploadHandler?: (file: File) => Promise; slashCommands?: SlashCommand[]; dragHandles?: boolean; onUpdate?: (json: any, editor: Editor) => void; onWordCount?: (stats: WordCountStats) => void; onSelectionChange?: (editor: Editor) => void; } export interface WordCountStats { words: number; characters: number; charactersNoSpaces: number; paragraphs: number; sentences: number; pages: number; readingTimeMinutes: number; } export declare class WordEditor { private editor; commands: CommandManager; private exporter; private importer; private printer; private _styleManager; private _pageLayout; private _zoom; constructor(options: WordEditorOptions); /** Push the current page-content height (in CSS pixels) into the Pagination * extension so the on-screen page boundary indicators reflect the layout. */ private syncPaginationLayout; getHTML(): string; getJSON(): any; getText(): string; isEmpty(): boolean; isEditable(): boolean; setDocument(content: string | any): void; clear(): void; focus(pos?: 'start' | 'end' | 'all' | number): void; blur(): void; destroy(): void; /** Toggle the editor between editable and read-only mode. */ setEditable(editable: boolean): void; get format(): CommandManager; exportDocx(filename?: string): Promise; exportMarkdown(filename?: string): Promise; exportHtml(filename?: string): void; exportJson(filename?: string): void; export(format: ExportFormat | 'markdown' | 'json', options?: ExportOptions): Promise; /** * Print only the editor content in an isolated iframe with A4 portrait * defaults. Use the browser's "Save as PDF" option to export PDF. */ printPdf(options?: PrintOptions): void; /** * Build print-ready HTML by cloning the live editor DOM. This preserves * NodeView-rendered content (Table of Contents, image resize wrappers, * text boxes) that `editor.getHTML()` cannot serialize, then strips * editor-only chrome (drag handles, resize handles, pagination spacers, * contenteditable attrs). */ getPrintableHTML(): string; importDocx(file: File): Promise; importMarkdown(text: string): Promise; importFromFile(file: File): Promise; getTableOfContents(): { level: number; text: string; id: string; }[]; getWordCount(): WordCountStats; toggleTrackChanges(): void; isTrackingChanges(): boolean; find(query: string, options?: { caseSensitive?: boolean; regex?: boolean; }): number; replace(query: string, replacement: string, all?: boolean, options?: { caseSensitive?: boolean; regex?: boolean; }): number; clearSearch(): void; /** Current measured page count from the Pagination extension. */ getPageCount(): number; /** Inside-page area in CSS pixels (page height minus top/bottom margins). */ getPageContentHeightPx(): number; getPageLayout(): PageLayoutOptions; setPageLayout(layout: Partial): void; private applyPageLayoutToDOM; getZoom(): number; setZoom(zoom: number): void; enableAutoSave(key?: string, debounceMs?: number): () => void; loadAutoSave(key?: string): boolean; clearAutoSave(key?: string): void; get instance(): Editor; get styleManager(): StyleManager; }