|
@@ -1,66 +1,31 @@
|
|
|
-import { Button } from '@/components/Button/Button';
|
|
|
|
|
-import '@wangeditor/editor/dist/css/style.css'; // 引入 css
|
|
|
|
|
-import './index.scss';
|
|
|
|
|
-import { IDomEditor, IEditorConfig, IToolbarConfig } from '@wangeditor/editor';
|
|
|
|
|
-import { Editor, Toolbar } from '@wangeditor/editor-for-react';
|
|
|
|
|
-import { Typography } from 'antd';
|
|
|
|
|
-import { useEffect, useState } from 'react';
|
|
|
|
|
|
|
+import { Button } from "@/components/Button/Button";
|
|
|
|
|
+import { useEffect, useState } from "react";
|
|
|
import WordEditor from "@/components/WordEditor/WordEditor";
|
|
import WordEditor from "@/components/WordEditor/WordEditor";
|
|
|
-
|
|
|
|
|
-const editorConfig: Partial<IEditorConfig> = {
|
|
|
|
|
- placeholder: '请输入内容...',
|
|
|
|
|
-};
|
|
|
|
|
-
|
|
|
|
|
-const toolbarConfig: Partial<IToolbarConfig> = {};
|
|
|
|
|
|
|
+import "./index.scss";
|
|
|
|
|
|
|
|
export function Edit() {
|
|
export function Edit() {
|
|
|
- const article =
|
|
|
|
|
- '这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字';
|
|
|
|
|
-
|
|
|
|
|
- const [editor, setEditor] = useState<IDomEditor | null>(null);
|
|
|
|
|
-
|
|
|
|
|
- const [isModified, setIsModified] = useState(false)
|
|
|
|
|
- const handleValueChange = (state: boolean)=> {
|
|
|
|
|
- setIsModified(state)
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- useEffect(() => {
|
|
|
|
|
- return () => {
|
|
|
|
|
- if (editor == null) return;
|
|
|
|
|
- editor.destroy();
|
|
|
|
|
- setEditor(null);
|
|
|
|
|
- };
|
|
|
|
|
- }, [editor]);
|
|
|
|
|
|
|
+ const [isModified, setIsModified] = useState(false);
|
|
|
|
|
+ const handleValueChange = (state: boolean) => {
|
|
|
|
|
+ setIsModified(state);
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<div className="edit">
|
|
<div className="edit">
|
|
|
- <div>写作题目</div>
|
|
|
|
|
- <div className="edit-text">
|
|
|
|
|
- <Typography.Paragraph
|
|
|
|
|
- ellipsis={{
|
|
|
|
|
- rows : 2,
|
|
|
|
|
- expandable: true,
|
|
|
|
|
- symbol : '展开',
|
|
|
|
|
- }}
|
|
|
|
|
- >
|
|
|
|
|
- {article}
|
|
|
|
|
- </Typography.Paragraph>
|
|
|
|
|
- <div className="down">
|
|
|
|
|
- <Button type="link">下载</Button>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
<div className="edit-box">
|
|
<div className="edit-box">
|
|
|
<div>编辑区</div>
|
|
<div>编辑区</div>
|
|
|
<div className="edit-root">
|
|
<div className="edit-root">
|
|
|
<WordEditor
|
|
<WordEditor
|
|
|
- onValueChange={handleValueChange}
|
|
|
|
|
- key={"13412453353_123524534324"}
|
|
|
|
|
- title={"13412453353_123524534324.docx"}
|
|
|
|
|
- url={"http://eai-files.oss-cn-shanghai.aliyuncs.com/13412453353_123524534324.docx"}
|
|
|
|
|
|
|
+ onValueChange={handleValueChange}
|
|
|
|
|
+ key={"13412453353_123524534324"}
|
|
|
|
|
+ title={"13412453353_123524534324.docx"}
|
|
|
|
|
+ url={
|
|
|
|
|
+ "http://eai-files.oss-cn-shanghai.aliyuncs.com/13412453353_123524534324.docx"
|
|
|
|
|
+ }
|
|
|
></WordEditor>
|
|
></WordEditor>
|
|
|
</div>
|
|
</div>
|
|
|
<div className="button-right">
|
|
<div className="button-right">
|
|
|
- <Button>只能批改</Button>
|
|
|
|
|
|
|
+ <Button>提交</Button>
|
|
|
|
|
+ <Button>暂存</Button>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|