/** * 导出工具 * 支持导出为 HTML、Markdown、PDF、图片格式 */ /** * 可导出编辑器类型 * 使用 any 以支持各种编辑器实例 */ type ExportableEditor = any; /** * 导出为 HTML 文件 * @param editor Plate 编辑器实例 * @param filename 文件名 */ export declare function exportAsHtml(editor: ExportableEditor, filename?: string): Promise; /** * 导出为 Markdown 文件 * @param editor Plate 编辑器实例 * @param filename 文件名 */ export declare function exportAsMarkdown(editor: ExportableEditor, filename?: string): Promise; /** * PDF 导出选项 * * @remarks * **中文支持说明:** * - `text` 模式使用 pdf-lib 的标准字体(Helvetica),不支持中文字符 * - 如需导出包含中文的 PDF,请使用 `image` 模式(默认) * - `image` 模式会将编辑器内容渲染为图片嵌入 PDF,支持所有字符和样式 * * @example * ```typescript * // 中文内容推荐使用 image 模式(默认) * await editorRef.current?.exportAsPdf('document.pdf'); * * // 纯英文内容可使用 text 模式(支持文本选择) * await editorRef.current?.exportAsPdf('document.pdf', { mode: 'text' }); * ``` */ export interface PdfExportOptions { /** * 导出模式 * - `image`(默认):将内容渲染为图片,支持中文和复杂样式,但不可选择文本 * - `text`:生成可选择文本的 PDF,仅支持英文和基本拉丁字符 */ mode?: 'image' | 'text'; /** 页面大小,默认 A4 */ pageSize?: 'A4' | 'Letter' | 'Legal' | [number, number]; /** 页边距(像素),默认 40 */ margin?: number; /** 字体大小(仅文本模式),默认 12 */ fontSize?: number; /** 行高(仅文本模式),默认 1.5 */ lineHeight?: number; /** 是否包含页眉,默认 false */ includeHeader?: boolean; /** 自定义页眉文本 */ headerText?: string; /** 是否包含页码,默认 true */ includePageNumbers?: boolean; /** * 图片模式缩放比例,默认 2(高清) * 值越大图片越清晰,但文件体积也越大 */ imageScale?: number; /** * 图片模式下是否自动分页,默认 true * 当内容超过一页时自动分页 */ autoPageBreak?: boolean; } /** * 导出为 PDF 文件 * * @param editor Plate 编辑器实例 * @param filename 文件名 * @param options 导出选项 * * @remarks * - 默认使用 image 模式,支持中文和复杂样式 * - text 模式仅支持英文和基本拉丁字符 * * @example * ```typescript * // 基础用法(推荐,支持中文) * await exportAsPdf(editor, 'document.pdf'); * * // 高清导出 * await exportAsPdf(editor, 'document.pdf', { imageScale: 3 }); * * // 文本模式(仅英文) * await exportAsPdf(editor, 'document.pdf', { mode: 'text' }); * ``` */ export declare function exportAsPdf(editor: ExportableEditor, filename?: string, options?: PdfExportOptions): Promise; /** * 导出为图片文件 * @param editor Plate 编辑器实例 * @param filename 文件名 */ export declare function exportAsImage(editor: ExportableEditor, filename?: string): Promise; export {};