import { Value } from 'platejs'; import { TPlateEditor } from 'platejs/react'; import { HtmlSerializeOptions } from '../../../lib/content-converter'; import { FindOptions, ReplaceOptions } from '../../../types/editor-types'; /** * 编辑器方法 Hook * 将 PlateEditor 中的方法逻辑拆分出来,提升性能和可维护性 */ import * as React from 'react'; /** * 内容管理方法 Hook * 提供 getContent, setContent, resetContent 等方法 */ export declare function useContentMethods(editor: TPlateEditor | null, initialValueRef: React.RefObject, previousValueRef: React.MutableRefObject, onChange?: (value: Value) => void): { getContent: () => Value; setContent: (content: Value) => void; resetContent: () => void; getText: () => string; isEmpty: () => boolean; }; /** * Markdown 方法 Hook */ export declare function useMarkdownMethods(editor: TPlateEditor | null, previousValueRef: React.MutableRefObject, onChange?: (value: Value) => void): { getMarkdown: () => string; setMarkdown: (markdown: string) => void; insertMarkdown: (markdown: string) => void; }; /** * HTML 方法 Hook */ export declare function useHtmlMethods(editor: TPlateEditor | null, previousValueRef: React.MutableRefObject, onChange?: (value: Value) => void): { getHtml: (options?: HtmlSerializeOptions) => Promise; setHtml: (html: string) => void; }; /** * 导出方法 Hook */ export declare function useExportMethods(editor: TPlateEditor | null): { exportAsHtml: (filename?: string) => Promise; exportAsMarkdown: (filename?: string) => Promise; exportAsPdf: (filename?: string) => Promise; exportAsImage: (filename?: string) => Promise; }; /** * 查找替换方法 Hook */ export declare function useFindReplaceMethods(editor: TPlateEditor | null): { find: (searchText: string, options?: FindOptions) => import('../../../types/editor-types').MatchPosition[]; replace: (searchText: string, replaceText: string, options?: ReplaceOptions) => number; }; /** * 文档分析方法 Hook */ export declare function useDocumentAnalysisMethods(editor: TPlateEditor | null): { getOutline: () => import('../../../types/editor-types').OutlineItem[]; getWordCount: () => import('../../../types/editor-types').WordCountResult; }; /** * 插入方法 Hook */ export declare function useInsertMethods(editor: TPlateEditor | null): { insertText: (text: string) => void; toggleMark: (mark: string) => void; insertLink: (url: string, text?: string) => void; insertImage: (url: string) => void; insertNodes: (nodes: Value, options?: { at?: number[]; }) => void; insertCodeBlock: (code: string, language?: string) => void; insertBlockquote: (text: string) => void; }; /** * 历史操作方法 Hook */ export declare function useHistoryMethods(editor: TPlateEditor | null): { undo: () => void; redo: () => void; canUndo: () => boolean; canRedo: () => boolean; clearHistory: () => void; }; /** * 编辑器控制方法 Hook */ export declare function useEditorControlMethods(editor: TPlateEditor | null): { focus: () => void; blur: () => void; };