From 93fc1e3e4435d4052226fbb9f3a4718b20efbfd5 Mon Sep 17 00:00:00 2001 From: jl-zhoujl2 Date: Tue, 5 Jul 2022 21:57:38 +0800 Subject: [PATCH] 7.5 wangeditor --- config/router.config.ts | 7 +++- src/components/richText/wang/index.tsx | 2 +- .../ProjectManager/components/WangEditor.tsx | 35 +++++++++++++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 src/pages/MainPage/ProjectManager/components/WangEditor.tsx diff --git a/config/router.config.ts b/config/router.config.ts index c4de15a..a814f7f 100644 --- a/config/router.config.ts +++ b/config/router.config.ts @@ -36,6 +36,11 @@ export default [ path: '/Calendar', component: './MainPage/ProjectManager/components/CalendarForm', }, + //富文本组件 + { + path: '/editor', + component: './MainPage/ProjectManager/components/WangEditor', + }, //401错误页 { exact: true, @@ -243,7 +248,7 @@ export default [ path: '/Supervision', component: './Project/ProjectManage/Supervision' }, - {//审查人员 项目管理页 + {//审查人员 项目管理页 name: 'Examination', path: '/Examination', component: './Project/ProjectManage/Examination' diff --git a/src/components/richText/wang/index.tsx b/src/components/richText/wang/index.tsx index e1151f8..14dd2eb 100644 --- a/src/components/richText/wang/index.tsx +++ b/src/components/richText/wang/index.tsx @@ -46,7 +46,7 @@ const BraftText: React.FC = (props) => { 'fullscreen', //全屏 // 'emoticon',//表情 - // 'image',//图片 + 'image',//图片 // 'video',//视频 // 'table',//表格 // 'todo',//待办 diff --git a/src/pages/MainPage/ProjectManager/components/WangEditor.tsx b/src/pages/MainPage/ProjectManager/components/WangEditor.tsx new file mode 100644 index 0000000..f6fe537 --- /dev/null +++ b/src/pages/MainPage/ProjectManager/components/WangEditor.tsx @@ -0,0 +1,35 @@ +import React, { useRef, useState } from 'react'; +import { Button, Typography } from 'antd'; +import BraftText from '@/components/richText/wang'; +import ProCard from '@ant-design/pro-card'; +import { isEmpty } from '@/utils/CommonUtils'; + +const Editor: React.FC<{}> = () => { + const braftRef = useRef(null); + const [text, setText] = useState(); + const { Text, Paragraph } = Typography; + return ( + + setText(braftRef.current?.getHtml())}>生成}> + + + + {isEmpty(text) ? '没有' : ( + +
+                            
+                                {text}
+                            
+                        
+
+ )} +
+
+ ); +}; + +export default Editor;