Skip to content

Commit

Permalink
refactor: 修改MarkdownDemo和RichTextEditorDemo的内容结构
Browse files Browse the repository at this point in the history
  • Loading branch information
NLRX-WJC committed May 17, 2020
1 parent 5f23122 commit dc814f1
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 26 deletions.
23 changes: 7 additions & 16 deletions src/components/Markdown/index.jsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
import React from "react";
import { Card } from "antd";
import "codemirror/lib/codemirror.css";
import "@toast-ui/editor/dist/toastui-editor.css";
import { Editor } from "@toast-ui/react-editor";
import TypingCard from "@/components/TypingCard";
const Markdown = () => {
const cardContent = `此页面用到的Markdown编辑器是<a href="https://github.com/nhn/tui.editor/tree/master/apps/react-editor" target="_blank">tui.editor(React版)</a>`;
return (
<div className="app-container">
<TypingCard title="Markdown编辑器" source={cardContent} />
<br />
<Card bordered={false}>
<Editor
initialValue="hello 难凉热血!"
previewStyle="vertical"
height="600px"
initialEditType="markdown"
useCommandShortcut={true}
/>
</Card>
</div>
<Editor
initialValue="hello 难凉热血!"
previewStyle="vertical"
height="600px"
initialEditType="markdown"
useCommandShortcut={true}
/>
);
};

Expand Down
7 changes: 1 addition & 6 deletions src/components/RichTextEditor/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Editor } from 'react-draft-wysiwyg';
import draftToHtml from 'draftjs-to-html';
import draftToMarkdown from 'draftjs-to-markdown';
import 'react-draft-wysiwyg/dist/react-draft-wysiwyg.css';
import TypingCard from '@/components/TypingCard'
import "./index.less"
class RichTextEditor extends Component {
state = {
Expand All @@ -17,12 +16,9 @@ class RichTextEditor extends Component {
});
};
render() {
const cardContent = `此页面用到的富文本编辑是<a href="https://github.com/jpuri/react-draft-wysiwyg">react-draft-wysiwyg</a>`
const { editorState } = this.state;
return (
<div className="app-container">
<TypingCard title='富文本编辑器' source={cardContent} />
<br/>
<div>
<Card bordered={false}>
<Editor
editorState={editorState}
Expand Down Expand Up @@ -51,5 +47,4 @@ class RichTextEditor extends Component {
}
}


export default RichTextEditor;
20 changes: 18 additions & 2 deletions src/views/components-demo/Markdown.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
import React from "react";
import { Card } from "antd";
import Markdown from "@/components/Markdown";
export default () => {
return <Markdown />;
import TypingCard from "@/components/TypingCard";

const MarkdownDemo = () => {
const cardContent = `
此页面用到的Markdown编辑器是<a href="https://github.com/nhn/tui.editor/tree/master/apps/react-editor" target="_blank">tui.editor(React版)</a>。
`;
return (
<div className="app-container">
<TypingCard title="新手引导" source={cardContent} />
<br />
<Card bordered={false}>
<Markdown />
</Card>
</div>
);
};

export default MarkdownDemo;
17 changes: 15 additions & 2 deletions src/views/components-demo/richTextEditor.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
import React from "react";
import RichTextEditor from "@/components/RichTextEditor";
export default () => {
return <RichTextEditor />;
import TypingCard from "@/components/TypingCard";

const RichTextEditorDemo = () => {
const cardContent = `
此页面用到的富文本编辑器是<a href="https://github.com/jpuri/react-draft-wysiwyg">react-draft-wysiwyg</a>。
`
return (
<div className="app-container">
<TypingCard title="新手引导" source={cardContent} />
<br />
<RichTextEditor />
</div>
);
};

export default RichTextEditorDemo;

0 comments on commit dc814f1

Please sign in to comment.