zy-react-library/components/Editor/index.d.ts

30 lines
787 B
TypeScript

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