diff --git a/package.json b/package.json index 451efd1..5849852 100644 --- a/package.json +++ b/package.json @@ -55,8 +55,6 @@ "@dnd-kit/utilities": "^3.2.2", "@tinymce/tinymce-react": "^6.2.1", "@umijs/route-utils": "^2.2.2", - "@wangeditor-next/editor": "^5.6.36", - "@wangeditor-next/editor-for-react": "^1.0.9", "aliyun-aliplayer": "^2.29.1", "aliyun-upload-vod": "^1.0.6", "antd": "^5.2.2", @@ -71,9 +69,7 @@ "react": "^18.2.0", "react-dev-inspector": "^1.8.4", "react-dom": "^18.2.0", - "react-helmet-async": "^1.3.0", - "wang-editor-next-plugin-import-from-word": "^0.0.3", - "wang-editor-plugin-import-from-word": "^0.0.2" + "react-helmet-async": "^1.3.0" }, "devDependencies": { "@ant-design/pro-cli": "^2.1.5", diff --git a/src/components/WangEditor/index.tsx b/src/components/WangEditor/index.tsx deleted file mode 100644 index 754c97e..0000000 --- a/src/components/WangEditor/index.tsx +++ /dev/null @@ -1,86 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import '@wangeditor-next/editor/dist/css/style.css'; // 引入wangEditor样式 -import { IDomEditor, IEditorConfig, IToolbarConfig, Boot } from '@wangeditor-next/editor'; -import { Editor, Toolbar } from '@wangeditor-next/editor-for-react'; - -// import wordModule from 'wang-editor-plugin-import-from-word'; - -interface WangEditorProps { - value?: string; - onChange?: (value: string) => void; -} - -const WangEditor: React.FC = ({ value, onChange }) => { - const [editor, setEditor] = useState(null); - const [html, setHtml] = useState(value ?? '

请输入内容...

'); - - // 外部value变化时同步到内部 - useEffect(() => { - if (typeof value === 'string' && value !== html) { - setHtml(value); - } - }, [value]); - - // 工具栏配置 - const toolbarConfig: Partial = {}; - - // 编辑器配置 - const editorConfig: Partial = { - placeholder: '请输入内容...', - MENU_CONF: { - //@ts-ignore - // importFromWord: { - // server: process.env.BASE_URL + '/oss/imgUpload', //一个文件地址 - // timeout: 5 * 1000, // 5s - - // fieldName: 'file', - // headers: { Accept: 'text/x-json' }, - // maxFileSize: 20 * 1024 * 1024, // 10M - // maxNumberOfFiles: 1, - // } - } - }; - - // 组件卸载时销毁editor实例 - useEffect(() => { - // Boot.registerModule(wordModule); - return () => { - if (editor == null) return; - editor.destroy(); - setEditor(null); - }; - }, [editor]); - - const handleChange = (editor: IDomEditor) => { - const newHtml = editor.getHtml(); - setHtml(newHtml); - if (onChange) { - onChange(newHtml); - } - }; - - return ( -
- - -
- 内容预览: -
-
-
- ); -}; - -export default WangEditor; \ No newline at end of file