|
@@ -2,6 +2,27 @@ import * as React from "react";
|
2
|
2
|
import ReactMde from 'react-mde';
|
3
|
3
|
import * as Showdown from "showdown";
|
4
|
4
|
import 'react-mde/lib/styles/css/react-mde-all.css';
|
|
5
|
+import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+const icons = {
|
|
9
|
+ "bold": <FontAwesomeIcon icon="bold" />,
|
|
10
|
+ "heading": <FontAwesomeIcon icon="heading" />,
|
|
11
|
+ "italic": <FontAwesomeIcon icon="italic" />,
|
|
12
|
+ "strikethrough": <FontAwesomeIcon icon="strikethrough" />,
|
|
13
|
+ "link": <FontAwesomeIcon icon="link" />,
|
|
14
|
+ "quote-right": <FontAwesomeIcon icon="quote-right" />,
|
|
15
|
+ "code": <FontAwesomeIcon icon="code" />,
|
|
16
|
+ "image": <FontAwesomeIcon icon="image" />,
|
|
17
|
+ "list-ul": <FontAwesomeIcon icon="list-ul" />,
|
|
18
|
+ "list-ol": <FontAwesomeIcon icon="list-ol" />,
|
|
19
|
+ "tasks": <FontAwesomeIcon icon="tasks" />,
|
|
20
|
+ };
|
|
21
|
+
|
|
22
|
+ const iconProvider = (name) => {
|
|
23
|
+ return icons[name] || "❓";
|
|
24
|
+ };
|
|
25
|
+
|
5
|
26
|
|
6
|
27
|
export default class MarkdownEditor extends React.Component {
|
7
|
28
|
|
|
@@ -21,6 +42,8 @@ export default class MarkdownEditor extends React.Component {
|
21
|
42
|
return (
|
22
|
43
|
<div className="container">
|
23
|
44
|
<ReactMde
|
|
45
|
+ layout="horizontal"
|
|
46
|
+ buttonContentOptions={{ iconProvider }}
|
24
|
47
|
onChange={this.handleValueChange}
|
25
|
48
|
editorState={this.state.mdeState}
|
26
|
49
|
generateMarkdownPreview={(markdown) => Promise.resolve(this.converter.makeHtml(markdown))}
|