Skip to content

Commit dc814f1

Browse files
committed
refactor: 修改MarkdownDemo和RichTextEditorDemo的内容结构
1 parent 5f23122 commit dc814f1

File tree

4 files changed

+41
-26
lines changed

4 files changed

+41
-26
lines changed

src/components/Markdown/index.jsx

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,16 @@
11
import React from "react";
2-
import { Card } from "antd";
32
import "codemirror/lib/codemirror.css";
43
import "@toast-ui/editor/dist/toastui-editor.css";
54
import { Editor } from "@toast-ui/react-editor";
6-
import TypingCard from "@/components/TypingCard";
75
const Markdown = () => {
8-
const cardContent = `此页面用到的Markdown编辑器是<a href="https://github.com/nhn/tui.editor/tree/master/apps/react-editor" target="_blank">tui.editor(React版)</a>`;
96
return (
10-
<div className="app-container">
11-
<TypingCard title="Markdown编辑器" source={cardContent} />
12-
<br />
13-
<Card bordered={false}>
14-
<Editor
15-
initialValue="hello 难凉热血!"
16-
previewStyle="vertical"
17-
height="600px"
18-
initialEditType="markdown"
19-
useCommandShortcut={true}
20-
/>
21-
</Card>
22-
</div>
7+
<Editor
8+
initialValue="hello 难凉热血!"
9+
previewStyle="vertical"
10+
height="600px"
11+
initialEditType="markdown"
12+
useCommandShortcut={true}
13+
/>
2314
);
2415
};
2516

src/components/RichTextEditor/index.jsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { Editor } from 'react-draft-wysiwyg';
55
import draftToHtml from 'draftjs-to-html';
66
import draftToMarkdown from 'draftjs-to-markdown';
77
import 'react-draft-wysiwyg/dist/react-draft-wysiwyg.css';
8-
import TypingCard from '@/components/TypingCard'
98
import "./index.less"
109
class RichTextEditor extends Component {
1110
state = {
@@ -17,12 +16,9 @@ class RichTextEditor extends Component {
1716
});
1817
};
1918
render() {
20-
const cardContent = `此页面用到的富文本编辑是<a href="https://github.com/jpuri/react-draft-wysiwyg">react-draft-wysiwyg</a>`
2119
const { editorState } = this.state;
2220
return (
23-
<div className="app-container">
24-
<TypingCard title='富文本编辑器' source={cardContent} />
25-
<br/>
21+
<div>
2622
<Card bordered={false}>
2723
<Editor
2824
editorState={editorState}
@@ -51,5 +47,4 @@ class RichTextEditor extends Component {
5147
}
5248
}
5349

54-
5550
export default RichTextEditor;
Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
import React from "react";
2+
import { Card } from "antd";
23
import Markdown from "@/components/Markdown";
3-
export default () => {
4-
return <Markdown />;
4+
import TypingCard from "@/components/TypingCard";
5+
6+
const MarkdownDemo = () => {
7+
const cardContent = `
8+
此页面用到的Markdown编辑器是<a href="https://github.com/nhn/tui.editor/tree/master/apps/react-editor" target="_blank">tui.editor(React版)</a>。
9+
`;
10+
return (
11+
<div className="app-container">
12+
<TypingCard title="新手引导" source={cardContent} />
13+
<br />
14+
<Card bordered={false}>
15+
<Markdown />
16+
</Card>
17+
</div>
18+
);
519
};
20+
21+
export default MarkdownDemo;
Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
import React from "react";
22
import RichTextEditor from "@/components/RichTextEditor";
3-
export default () => {
4-
return <RichTextEditor />;
3+
import TypingCard from "@/components/TypingCard";
4+
5+
const RichTextEditorDemo = () => {
6+
const cardContent = `
7+
此页面用到的富文本编辑器是<a href="https://github.com/jpuri/react-draft-wysiwyg">react-draft-wysiwyg</a>。
8+
`
9+
return (
10+
<div className="app-container">
11+
<TypingCard title="新手引导" source={cardContent} />
12+
<br />
13+
<RichTextEditor />
14+
</div>
15+
);
516
};
17+
18+
export default RichTextEditorDemo;

0 commit comments

Comments
 (0)