forked from outline/rich-markdown-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmarks.js
30 lines (27 loc) · 747 Bytes
/
marks.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// @flow
import * as React from "react";
import { Mark, Editor } from "slate";
import InlineCode from "./components/InlineCode";
type Props = {
children: React$Element<*>,
mark: Mark,
};
function renderMark(props: Props, editor: Editor, next: Function) {
switch (props.mark.type) {
case "bold":
return <strong>{props.children}</strong>;
case "code":
return <InlineCode>{props.children}</InlineCode>;
case "italic":
return <em>{props.children}</em>;
case "underlined":
return <u>{props.children}</u>;
case "deleted":
return <del>{props.children}</del>;
case "inserted":
return <mark>{props.children}</mark>;
default:
return next();
}
}
export default { renderMark };