import type { Extensions } from '@tiptap/core'; export interface TextDiff { offset: number; length: number; text: string; operation: number; } export interface AttrChange { key: string; oldValue: any; newValue: any; fromOffset?: number; toOffset?: number; } export interface DiffItem { type: 'insert' | 'delete' | 'modify'; path: number[]; node?: any; textDiff?: TextDiff; attrChange?: AttrChange; } export interface DocumentComparison { oldDoc: any; newDoc: any; diffs: DiffItem[]; hasChanges: boolean; } export interface ProseMirrorNode { type: string; attrs?: Record; content?: ProseMirrorNode[]; text?: string; marks?: Array<{ type: string; attrs?: Record; }>; } export type StructuredDiffEngine = 'legacy' | 'enhanced'; export interface StructuredDiffOptions { engine?: StructuredDiffEngine; ignoreAttrs?: string[]; nodePreviewSerializer?: (node: ProseMirrorNode) => string | null | undefined; } /** * 将HTML转换为ProseMirror文档结构 * @param {string} html - HTML字符串 * @param {Array} extensions - Tiptap扩展数组 * @returns {Object} ProseMirror文档对象 */ export declare function parseHtmlToDoc(html: string, extensions: Extensions): any; /** * 对比两个HTML文档并生成结构化差异 * @param {string} oldHtml - 旧HTML * @param {string} newHtml - 新HTML * @param {Array} extensions - Tiptap扩展数组 * @returns {Object} 包含差异信息的对象 */ export declare function compareDocuments(oldHtml: string, newHtml: string, extensions: Extensions, options?: StructuredDiffOptions): DocumentComparison; /** * 将路径转换为ProseMirror位置 * @param {Array} path - 节点路径 * @param {Object} doc - ProseMirror文档 * @returns {number} 文档位置 */ export declare function pathToPos(path: number[], doc: any): number;