diff --git a/src/editor/index.tsx b/src/editor/index.tsx index 0d86d73..2e2dce3 100644 --- a/src/editor/index.tsx +++ b/src/editor/index.tsx @@ -16,7 +16,7 @@ import { HtmlRender, HtmlType } from './preview'; type Plugin = { comp: any; config: any }; -interface EditorProps extends EditorConfig { +export interface EditorProps extends EditorConfig { id?: string; defaultValue?: string; value?: string; @@ -41,7 +41,7 @@ interface EditorProps extends EditorConfig { onScroll?: (e: React.UIEvent, type: 'md' | 'html') => void; } -interface EditorState { +export interface EditorState { text: string; html: HtmlType; fullScreen: boolean; diff --git a/src/index.ts b/src/index.ts index 2512b7a..7ec7b00 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import Editor from './editor'; +import Editor, { EditorProps, EditorState } from './editor'; import AutoResize from './plugins/autoResize'; import BlockCodeBlock from './plugins/block/code-block'; import BlockCodeInline from './plugins/block/code-inline'; @@ -48,6 +48,8 @@ Editor.use(FullScreen); export { DropList }; export { PluginComponent }; export type { PluginProps }; +// 导出编辑器类型 +export type { EditorProps, EditorState }; // 导出实用工具 export { default as getDecorated } from './utils/decorate'; // 导出内置插件