From c28e703e8650361b5d473fd09ba1a4d62f56f8fe Mon Sep 17 00:00:00 2001 From: TachibanaKimika Date: Sun, 21 Aug 2022 14:08:08 +0800 Subject: [PATCH] feat: export Editor props & state --- src/editor/index.tsx | 4 ++-- src/index.ts | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) 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'; // 导出内置插件