30 lines
763 B
TypeScript
30 lines
763 B
TypeScript
import type { IDomEditor } from "@wangeditor/editor";
|
|
import type { ForwardRefExoticComponent, RefAttributes } from "react";
|
|
|
|
export interface EditorProps {
|
|
/** 编辑器内容值 */
|
|
value?: string;
|
|
/** 内容改变回调 */
|
|
onChange?: (html: string) => void;
|
|
/** 是否禁用 */
|
|
disabled?: boolean;
|
|
}
|
|
|
|
export interface EditorRef {
|
|
/** 获取编辑器实例 */
|
|
getEditorInstance: () => IDomEditor | null;
|
|
/** 获取HTML内容 */
|
|
getHtml: () => string | undefined;
|
|
/** 设置HTML内容 */
|
|
setHtml: (value: string) => void;
|
|
/** 获取文本内容 */
|
|
getText: () => string | undefined;
|
|
}
|
|
|
|
/**
|
|
* 富文本编辑器组件
|
|
*/
|
|
declare const Editor: ForwardRefExoticComponent<EditorProps & RefAttributes<EditorRef>>;
|
|
|
|
export default Editor;
|