highmark-markdown 1.0.40 → 1.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/example.js +3154 -1252
- package/lib/elementMap.js +4 -1
- package/lib/example/customEventTypes.js +17 -1
- package/lib/example/importer.js +2 -6
- package/lib/example/view/{div/sizeable/right.js → button/tab/css.js} +44 -33
- package/lib/example/view/button/tab/html.js +146 -0
- package/lib/example/view/button/tab/markdown.js +2 -23
- package/lib/example/view/button/tab/markdownStyle.js +2 -23
- package/lib/example/view/button/tab/plainText.js +146 -0
- package/lib/example/view/button/tab/preview.js +146 -0
- package/lib/example/view/button/tab.js +2 -2
- package/lib/example/view/div/container/css.js +186 -0
- package/lib/example/view/div/container/html.js +188 -0
- package/lib/example/view/div/container/plainText.js +186 -0
- package/lib/example/view/div/container/preview.js +212 -0
- package/lib/example/view/div/container.js +2 -2
- package/lib/example/view/div/preview.js +2 -2
- package/lib/example/view/div/tabButtons/left.js +206 -0
- package/lib/example/view/div/tabButtons/right.js +246 -0
- package/lib/example/view/div/tabButtons.js +3 -59
- package/lib/example/view/textarea/css.js +2 -2
- package/lib/example/view/textarea/plainText.js +183 -0
- package/lib/example/view/textarea.js +2 -2
- package/lib/example/view.js +99 -47
- package/lib/node/markdown/tableBodyCell.js +8 -1
- package/lib/node/markdown/tableHeadCell.js +8 -1
- package/package.json +5 -5
- package/src/elementMap.js +5 -0
- package/src/example/customEventTypes.js +4 -0
- package/src/example/importer.js +1 -3
- package/src/example/view/button/tab/css.js +23 -0
- package/src/example/view/button/tab/html.js +23 -0
- package/src/example/view/button/tab/markdown.js +1 -15
- package/src/example/view/button/tab/markdownStyle.js +1 -13
- package/src/example/view/button/tab/plainText.js +23 -0
- package/src/example/view/button/tab/preview.js +23 -0
- package/src/example/view/button/tab.js +4 -5
- package/src/example/view/div/container/css.js +30 -0
- package/src/example/view/div/container/html.js +30 -0
- package/src/example/view/div/container/plainText.js +30 -0
- package/src/example/view/div/container/preview.js +43 -0
- package/src/example/view/div/container.js +0 -3
- package/src/example/view/div/preview.js +1 -2
- package/src/example/view/div/tabButtons/left.js +66 -0
- package/src/example/view/div/tabButtons/right.js +106 -0
- package/src/example/view/div/tabButtons.js +0 -49
- package/src/example/view/textarea/css.js +1 -1
- package/src/example/view/textarea/plainText.js +46 -0
- package/src/example/view/textarea.js +2 -0
- package/src/example/view.js +112 -71
- package/src/node/markdown/tableBodyCell.js +9 -0
- package/src/node/markdown/tableHeadCell.js +9 -0
- package/lib/example/view/subHeading.js +0 -39
- package/src/example/view/div/sizeable/right.js +0 -19
- package/src/example/view/subHeading.js +0 -16
package/src/elementMap.js
CHANGED
|
@@ -46,6 +46,7 @@ import { LINE_RULE_NAME,
|
|
|
46
46
|
PRIMARY_HEADING_RULE_NAME,
|
|
47
47
|
INDEX_DIRECTIVE_RULE_NAME,
|
|
48
48
|
EMBED_DIRECTIVE_RULE_NAME,
|
|
49
|
+
EMPTY_TABLE_CELL_RULE_NAME,
|
|
49
50
|
TERTIARY_HEADING_RULE_NAME,
|
|
50
51
|
IGNORE_DIRECTIVE_RULE_NAME,
|
|
51
52
|
ORDERED_LIST_ITEM_RULE_NAME,
|
|
@@ -245,6 +246,10 @@ const elementMap = {
|
|
|
245
246
|
tagName: null,
|
|
246
247
|
className: null
|
|
247
248
|
},
|
|
249
|
+
[EMPTY_TABLE_CELL_RULE_NAME]: {
|
|
250
|
+
tagName: null,
|
|
251
|
+
className: null
|
|
252
|
+
},
|
|
248
253
|
[TERTIARY_HEADING_RULE_NAME]: {
|
|
249
254
|
tagName: "h3",
|
|
250
255
|
className: null
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
export const CSS_CUSTOM_EVENT_TYPE = "css";
|
|
4
|
+
export const HTML_CUSTOM_EVENT_TYPE = "html";
|
|
3
5
|
export const KEY_UP_CUSTOM_EVENT_TYPE = "key-up";
|
|
6
|
+
export const PREVIEW_CUSTOM_EVENT_TYPE = "preview";
|
|
4
7
|
export const MARKDOWN_CUSTOM_EVENT_TYPE = "markdown";
|
|
8
|
+
export const PLAIN_TEXT_CUSTOM_EVENT_TYPE = "plain-text";
|
|
5
9
|
export const PAGE_UPDATE_CUSTOM_EVENT_TYPE = "page-update";
|
|
6
10
|
export const MARKDOWN_STYLE_CUSTOM_EVENT_TYPE = "markdown-style";
|
package/src/example/importer.js
CHANGED
|
@@ -43,9 +43,7 @@ const INDEX_PATH = "index.md",
|
|
|
43
43
|
INSTALLING_THE_CLI_PATH = "installing-the-cli.md",
|
|
44
44
|
GETTING_TO_GRIPS_WITH_THE_IDE_PATH = "getting-to-grips-with-the-ide.md";
|
|
45
45
|
|
|
46
|
-
export const defaultContent =
|
|
47
|
-
|
|
48
|
-
export const _defaultContent = `@ignore
|
|
46
|
+
export const defaultContent = `@ignore
|
|
49
47
|
|
|
50
48
|
@include ${FRONT_MATTER_PATH}
|
|
51
49
|
@include ${CONTENT_PATH}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import TabButton from "../../button/tab";
|
|
4
|
+
|
|
5
|
+
export default class CSSTabButton extends TabButton {
|
|
6
|
+
childElements() {
|
|
7
|
+
return "CSS";
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
parentContext() {
|
|
11
|
+
const enableCSSTabButton = this.enable.bind(this), ///
|
|
12
|
+
disableCSSTabButton = this.disable.bind(this); ///
|
|
13
|
+
|
|
14
|
+
return ({
|
|
15
|
+
enableCSSTabButton,
|
|
16
|
+
disableCSSTabButton
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static defaultProperties = {
|
|
21
|
+
className: "css"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import TabButton from "../../button/tab";
|
|
4
|
+
|
|
5
|
+
export default class HTMLTabButton extends TabButton {
|
|
6
|
+
childElements() {
|
|
7
|
+
return "HTML";
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
parentContext() {
|
|
11
|
+
const enableHTMLTabButton = this.enable.bind(this), ///
|
|
12
|
+
disableHTMLTabButton = this.disable.bind(this); ///
|
|
13
|
+
|
|
14
|
+
return ({
|
|
15
|
+
enableHTMLTabButton,
|
|
16
|
+
disableHTMLTabButton
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static defaultProperties = {
|
|
21
|
+
className: "html"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import withStyle from "easy-with-style"; ///
|
|
4
|
-
|
|
5
3
|
import TabButton from "../../button/tab";
|
|
6
4
|
|
|
7
|
-
class MarkdownTabButton extends TabButton {
|
|
5
|
+
export default class MarkdownTabButton extends TabButton {
|
|
8
6
|
childElements() {
|
|
9
7
|
return "Markdown";
|
|
10
8
|
}
|
|
@@ -23,15 +21,3 @@ class MarkdownTabButton extends TabButton {
|
|
|
23
21
|
className: "markdown"
|
|
24
22
|
}
|
|
25
23
|
}
|
|
26
|
-
|
|
27
|
-
export default withStyle(MarkdownTabButton)`
|
|
28
|
-
|
|
29
|
-
border-right-width: 0;
|
|
30
|
-
|
|
31
|
-
border-left-width: 1px;
|
|
32
|
-
|
|
33
|
-
:enabled {
|
|
34
|
-
border-left-width: 0;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
`;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import withStyle from "easy-with-style"; ///
|
|
4
|
-
|
|
5
3
|
import TabButton from "../../button/tab";
|
|
6
4
|
|
|
7
|
-
class MarkdownStyleTabButton extends TabButton {
|
|
5
|
+
export default class MarkdownStyleTabButton extends TabButton {
|
|
8
6
|
childElements() {
|
|
9
7
|
return "Markdown style";
|
|
10
8
|
}
|
|
@@ -23,13 +21,3 @@ class MarkdownStyleTabButton extends TabButton {
|
|
|
23
21
|
className: "markdown-style"
|
|
24
22
|
}
|
|
25
23
|
}
|
|
26
|
-
|
|
27
|
-
export default withStyle(MarkdownStyleTabButton)`
|
|
28
|
-
|
|
29
|
-
border-right-width: 1px;
|
|
30
|
-
|
|
31
|
-
:enabled {
|
|
32
|
-
border-right-width: 0;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
`;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import TabButton from "../../button/tab";
|
|
4
|
+
|
|
5
|
+
export default class PlainTextTabButton extends TabButton {
|
|
6
|
+
childElements() {
|
|
7
|
+
return "PlainText";
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
parentContext() {
|
|
11
|
+
const enablePlainTextTabButton = this.enable.bind(this), ///
|
|
12
|
+
disablePlainTextTabButton = this.disable.bind(this); ///
|
|
13
|
+
|
|
14
|
+
return ({
|
|
15
|
+
enablePlainTextTabButton,
|
|
16
|
+
disablePlainTextTabButton
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static defaultProperties = {
|
|
21
|
+
className: "plainText"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import TabButton from "../../button/tab";
|
|
4
|
+
|
|
5
|
+
export default class PreviewTabButton extends TabButton {
|
|
6
|
+
childElements() {
|
|
7
|
+
return "Preview";
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
parentContext() {
|
|
11
|
+
const enablePreviewTabButton = this.enable.bind(this), ///
|
|
12
|
+
disablePreviewTabButton = this.disable.bind(this); ///
|
|
13
|
+
|
|
14
|
+
return ({
|
|
15
|
+
enablePreviewTabButton,
|
|
16
|
+
disablePreviewTabButton
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static defaultProperties = {
|
|
21
|
+
className: "preview"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -14,20 +14,19 @@ export default withStyle(TabButton)`
|
|
|
14
14
|
|
|
15
15
|
color: black;
|
|
16
16
|
cursor: pointer;
|
|
17
|
-
border: 1px solid black;
|
|
18
17
|
padding: 1rem;
|
|
19
18
|
font-size: 2rem;
|
|
20
19
|
background: transparent;
|
|
21
20
|
font-family: serif;
|
|
22
21
|
|
|
22
|
+
border: 1px solid black;
|
|
23
23
|
font-weight: bold;
|
|
24
|
-
border-
|
|
25
|
-
border-bottom-width: 0;
|
|
24
|
+
border-bottom: 0;
|
|
26
25
|
|
|
27
26
|
:enabled {
|
|
27
|
+
border: 0;
|
|
28
28
|
font-weight: normal;
|
|
29
|
-
border-
|
|
30
|
-
border-bottom-width: 1px;
|
|
29
|
+
border-bottom: 1px solid black;
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
`;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import CSSTextarea from "../../textarea/css";
|
|
4
|
+
import ContainerDiv from "../../div/container";
|
|
5
|
+
|
|
6
|
+
export default class CSSContainerDiv extends ContainerDiv {
|
|
7
|
+
childElements() {
|
|
8
|
+
return (
|
|
9
|
+
|
|
10
|
+
<CSSTextarea/>
|
|
11
|
+
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
parentContext() {
|
|
16
|
+
const context = this.getContext(),
|
|
17
|
+
showCSSContainerDiv = this.show.bind(this), ///
|
|
18
|
+
hideCSSContainerDiv = this.hide.bind(this); ///
|
|
19
|
+
|
|
20
|
+
return ({
|
|
21
|
+
...context,
|
|
22
|
+
showCSSContainerDiv,
|
|
23
|
+
hideCSSContainerDiv
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
static defaultProperties = {
|
|
28
|
+
className: "css"
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import HTMLDiv from "../../div/html";
|
|
4
|
+
import ContainerDiv from "../../div/container";
|
|
5
|
+
|
|
6
|
+
export default class HTMLContainerDiv extends ContainerDiv {
|
|
7
|
+
childElements() {
|
|
8
|
+
return ([
|
|
9
|
+
|
|
10
|
+
<HTMLDiv/>
|
|
11
|
+
|
|
12
|
+
]);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
parentContext() {
|
|
16
|
+
const context = this.getContext(),
|
|
17
|
+
showHTMLContainerDiv = this.show.bind(this), ///
|
|
18
|
+
hideHTMLContainerDiv = this.hide.bind(this); ///
|
|
19
|
+
|
|
20
|
+
return ({
|
|
21
|
+
...context,
|
|
22
|
+
showHTMLContainerDiv,
|
|
23
|
+
hideHTMLContainerDiv
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
static defaultProperties = {
|
|
28
|
+
className: "html"
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import ContainerDiv from "../../div/container";
|
|
4
|
+
import PlainTextTextarea from "../../textarea/plainText";
|
|
5
|
+
|
|
6
|
+
export default class PlainTextContainerDiv extends ContainerDiv {
|
|
7
|
+
childElements() {
|
|
8
|
+
return (
|
|
9
|
+
|
|
10
|
+
<PlainTextTextarea/>
|
|
11
|
+
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
parentContext() {
|
|
16
|
+
const context = this.getContext(),
|
|
17
|
+
showPlainTextContainerDiv = this.show.bind(this), ///
|
|
18
|
+
hidePlainTextContainerDiv = this.hide.bind(this); ///
|
|
19
|
+
|
|
20
|
+
return ({
|
|
21
|
+
...context,
|
|
22
|
+
showPlainTextContainerDiv,
|
|
23
|
+
hidePlainTextContainerDiv
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
static defaultProperties = {
|
|
28
|
+
className: "plain-text"
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import withStyle from "easy-with-style"; ///
|
|
4
|
+
|
|
5
|
+
import PreviewDiv from "../../div/preview";
|
|
6
|
+
import ContainerDiv from "../../div/container";
|
|
7
|
+
|
|
8
|
+
class PreviewContainerDiv extends ContainerDiv {
|
|
9
|
+
childElements() {
|
|
10
|
+
const { onCustomPageUpdate } = this.properties,
|
|
11
|
+
pageUpdateCustomHandler = onCustomPageUpdate; ///
|
|
12
|
+
|
|
13
|
+
return ([
|
|
14
|
+
|
|
15
|
+
<PreviewDiv onCustomPageUpdate={pageUpdateCustomHandler} />
|
|
16
|
+
|
|
17
|
+
]);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
parentContext() {
|
|
21
|
+
const context = this.getContext(),
|
|
22
|
+
showPreviewContainerDiv = this.show.bind(this), ///
|
|
23
|
+
hidePreviewContainerDiv = this.hide.bind(this); ///
|
|
24
|
+
|
|
25
|
+
return ({
|
|
26
|
+
...context,
|
|
27
|
+
showPreviewContainerDiv,
|
|
28
|
+
hidePreviewContainerDiv
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static ignoredProperties = [
|
|
33
|
+
"onCustomPageUpdate"
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default withStyle(PreviewContainerDiv)`
|
|
38
|
+
|
|
39
|
+
height: 56rem;
|
|
40
|
+
padding: 0;
|
|
41
|
+
position: relative;
|
|
42
|
+
|
|
43
|
+
`;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import withStyle from "easy-with-style"; ///
|
|
4
|
+
|
|
5
|
+
import TabButtonsDiv from "../../div/tabButtons";
|
|
6
|
+
import MarkdownTabButton from "../../button/tab/markdown";
|
|
7
|
+
import MarkdownStyleTabButton from "../../button/tab/markdownStyle";
|
|
8
|
+
|
|
9
|
+
import { MARKDOWN_CUSTOM_EVENT_TYPE, MARKDOWN_STYLE_CUSTOM_EVENT_TYPE } from "../../../customEventTypes";
|
|
10
|
+
|
|
11
|
+
class LeftTabButtonsDiv extends TabButtonsDiv {
|
|
12
|
+
markdownStyleTabButtonClickHandler = (event, element) => {
|
|
13
|
+
this.markdownStyle(event, element);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
markdownTabButtonClickHandler = (event, element) => {
|
|
17
|
+
this.markdown(event, element);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
markdownStyle(event, element) {
|
|
21
|
+
const eventType = MARKDOWN_STYLE_CUSTOM_EVENT_TYPE;
|
|
22
|
+
|
|
23
|
+
this.enableMarkdownTabButton();
|
|
24
|
+
|
|
25
|
+
this.disableMarkdownStyleTabButton();
|
|
26
|
+
|
|
27
|
+
this.callCustomHandlers(eventType, event, element);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
markdown(event = null, element = null) {
|
|
31
|
+
const eventType = MARKDOWN_CUSTOM_EVENT_TYPE;
|
|
32
|
+
|
|
33
|
+
this.disableMarkdownTabButton();
|
|
34
|
+
|
|
35
|
+
this.enableMarkdownStyleTabButton();
|
|
36
|
+
|
|
37
|
+
this.callCustomHandlers(eventType, event, element);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
didMount() {
|
|
41
|
+
this.markdown();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
willUnmount() {
|
|
45
|
+
///
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
childElements() {
|
|
49
|
+
return ([
|
|
50
|
+
|
|
51
|
+
<MarkdownTabButton onClick={this.markdownTabButtonClickHandler} />,
|
|
52
|
+
<MarkdownStyleTabButton onClick={this.markdownStyleTabButtonClickHandler} />
|
|
53
|
+
|
|
54
|
+
]);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static defaultProperties = {
|
|
58
|
+
className: "left"
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default withStyle(LeftTabButtonsDiv)`
|
|
63
|
+
|
|
64
|
+
grid-template-columns: 1fr 1fr;
|
|
65
|
+
|
|
66
|
+
`;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import withStyle from "easy-with-style"; ///
|
|
4
|
+
|
|
5
|
+
import CSSTabButton from "../../button/tab/css";
|
|
6
|
+
import HTMLTabButton from "../../button/tab/html";
|
|
7
|
+
import TabButtonsDiv from "../../div/tabButtons";
|
|
8
|
+
import PreviewTabButton from "../../button/tab/preview";
|
|
9
|
+
import PlainTextTabButton from "../../button/tab/plainText";
|
|
10
|
+
|
|
11
|
+
import { CSS_CUSTOM_EVENT_TYPE, HTML_CUSTOM_EVENT_TYPE, PREVIEW_CUSTOM_EVENT_TYPE, PLAIN_TEXT_CUSTOM_EVENT_TYPE } from "../../../customEventTypes";
|
|
12
|
+
|
|
13
|
+
class RightTabButtonsDiv extends TabButtonsDiv {
|
|
14
|
+
cssTabButtonClickHandler = (event, element) => {
|
|
15
|
+
this.css(event, element);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
htmlTabButtonClickHandler = (event, element) => {
|
|
19
|
+
this.html(event, element);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
previewTabButtonClickHandler = (event, element) => {
|
|
23
|
+
this.preview(event, element);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
plainTextTabButtonClickHandler = (event, element) => {
|
|
27
|
+
this.plainText(event, element);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
css(event = null, element = null) {
|
|
31
|
+
const eventType = CSS_CUSTOM_EVENT_TYPE;
|
|
32
|
+
|
|
33
|
+
this.disableCSSTabButton();
|
|
34
|
+
|
|
35
|
+
this.enableHTMLTabButton();
|
|
36
|
+
this.enablePreviewTabButton();
|
|
37
|
+
this.enablePlainTextTabButton();
|
|
38
|
+
|
|
39
|
+
this.callCustomHandlers(eventType, event, element);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
html(event, element) {
|
|
43
|
+
const eventType = HTML_CUSTOM_EVENT_TYPE;
|
|
44
|
+
|
|
45
|
+
this.disableHTMLTabButton();
|
|
46
|
+
|
|
47
|
+
this.enableCSSTabButton();
|
|
48
|
+
this.enablePreviewTabButton();
|
|
49
|
+
this.enablePlainTextTabButton();
|
|
50
|
+
|
|
51
|
+
this.callCustomHandlers(eventType, event, element);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
preview(event, element) {
|
|
55
|
+
const eventType = PREVIEW_CUSTOM_EVENT_TYPE;
|
|
56
|
+
|
|
57
|
+
this.disablePreviewTabButton();
|
|
58
|
+
|
|
59
|
+
this.enableCSSTabButton();
|
|
60
|
+
this.enableHTMLTabButton();
|
|
61
|
+
this.enablePlainTextTabButton();
|
|
62
|
+
|
|
63
|
+
this.callCustomHandlers(eventType, event, element);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
plainText(event, element) {
|
|
67
|
+
const eventType = PLAIN_TEXT_CUSTOM_EVENT_TYPE;
|
|
68
|
+
|
|
69
|
+
this.disablePlainTextTabButton();
|
|
70
|
+
|
|
71
|
+
this.enableCSSTabButton();
|
|
72
|
+
this.enableHTMLTabButton();
|
|
73
|
+
this.enablePreviewTabButton();
|
|
74
|
+
|
|
75
|
+
this.callCustomHandlers(eventType, event, element);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
didMount() {
|
|
79
|
+
this.css();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
willUnmount() {
|
|
83
|
+
///
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
childElements() {
|
|
87
|
+
return ([
|
|
88
|
+
|
|
89
|
+
<CSSTabButton onClick={this.cssTabButtonClickHandler} />,
|
|
90
|
+
<HTMLTabButton onClick={this.htmlTabButtonClickHandler} />,
|
|
91
|
+
<PreviewTabButton onClick={this.previewTabButtonClickHandler} />,
|
|
92
|
+
<PlainTextTabButton onClick={this.plainTextTabButtonClickHandler} />
|
|
93
|
+
|
|
94
|
+
]);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
static defaultProperties = {
|
|
98
|
+
className: "right"
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export default withStyle(RightTabButtonsDiv)`
|
|
103
|
+
|
|
104
|
+
grid-template-columns: 1fr 1fr 1fr 1fr;
|
|
105
|
+
|
|
106
|
+
`;
|
|
@@ -4,55 +4,7 @@ import withStyle from "easy-with-style"; ///
|
|
|
4
4
|
|
|
5
5
|
import { Element } from "easy";
|
|
6
6
|
|
|
7
|
-
import MarkdownTabButton from "../button/tab/markdown";
|
|
8
|
-
import MarkdownStyleTabButton from "../button/tab/markdownStyle";
|
|
9
|
-
|
|
10
|
-
import { MARKDOWN_CUSTOM_EVENT_TYPE, MARKDOWN_STYLE_CUSTOM_EVENT_TYPE } from "../../customEventTypes";
|
|
11
|
-
|
|
12
7
|
class TabButtonsDiv extends Element {
|
|
13
|
-
markdownStyleTabButtonClickHandler = (event, element) => {
|
|
14
|
-
this.markdownStyle(event, element);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
markdownTabButtonClickHandler = (event, element) => {
|
|
18
|
-
this.markdown(event, element);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
markdownStyle(event = null, element = null) {
|
|
22
|
-
this.enableMarkdownTabButton();
|
|
23
|
-
this.disableMarkdownStyleTabButton();
|
|
24
|
-
|
|
25
|
-
const eventType = MARKDOWN_STYLE_CUSTOM_EVENT_TYPE;
|
|
26
|
-
|
|
27
|
-
this.callCustomHandlers(eventType, event, element);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
markdown(event = null, element = null) {
|
|
31
|
-
this.disableMarkdownTabButton();
|
|
32
|
-
this.enableMarkdownStyleTabButton();
|
|
33
|
-
|
|
34
|
-
const eventType = MARKDOWN_CUSTOM_EVENT_TYPE;
|
|
35
|
-
|
|
36
|
-
this.callCustomHandlers(eventType, event, element);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
didMount() {
|
|
40
|
-
this.markdown();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
willUnmount() {
|
|
44
|
-
///
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
childElements() {
|
|
48
|
-
return ([
|
|
49
|
-
|
|
50
|
-
<MarkdownTabButton onClick={this.markdownTabButtonClickHandler} />,
|
|
51
|
-
<MarkdownStyleTabButton onClick={this.markdownStyleTabButtonClickHandler} />
|
|
52
|
-
|
|
53
|
-
]);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
8
|
initialise() {
|
|
57
9
|
this.assignContext();
|
|
58
10
|
}
|
|
@@ -68,6 +20,5 @@ export default withStyle(TabButtonsDiv)`
|
|
|
68
20
|
|
|
69
21
|
display: grid;
|
|
70
22
|
grid-template-rows: auto;
|
|
71
|
-
grid-template-columns: 1fr 1fr;
|
|
72
23
|
|
|
73
24
|
`;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import withStyle from "easy-with-style"; ///
|
|
4
|
+
|
|
5
|
+
import Textarea from "../textarea";
|
|
6
|
+
|
|
7
|
+
import { EMPTY_STRING } from "../../constants";
|
|
8
|
+
|
|
9
|
+
class PlainTextTextarea extends Textarea {
|
|
10
|
+
setPlainText(plainText) {
|
|
11
|
+
const value = plainText; ///
|
|
12
|
+
|
|
13
|
+
this.setValue(value);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
clear() {
|
|
17
|
+
const plainText = EMPTY_STRING;
|
|
18
|
+
|
|
19
|
+
this.setPlainText(plainText);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
update(plainText) {
|
|
23
|
+
this.setPlainText(plainText);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
parentContext() {
|
|
27
|
+
const clearPlainTextTextarea = this.clear.bind(this), ///
|
|
28
|
+
updatePlainTextTextarea = this.update.bind(this);
|
|
29
|
+
|
|
30
|
+
return ({
|
|
31
|
+
clearPlainTextTextarea,
|
|
32
|
+
updatePlainTextTextarea
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static defaultProperties = {
|
|
37
|
+
readOnly: true,
|
|
38
|
+
className: "plain-text"
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default withStyle(PlainTextTextarea)`
|
|
43
|
+
|
|
44
|
+
height: 48rem;
|
|
45
|
+
|
|
46
|
+
`;
|
|
@@ -6,10 +6,12 @@ import { Textarea } from "easy";
|
|
|
6
6
|
|
|
7
7
|
export default withStyle(Textarea)`
|
|
8
8
|
|
|
9
|
+
width: 100%;
|
|
9
10
|
border: 1px solid darkgrey;
|
|
10
11
|
resize: vertical;
|
|
11
12
|
padding: 0.25rem;
|
|
12
13
|
font-size: 1.2rem;
|
|
14
|
+
min-height: 24rem;
|
|
13
15
|
line-height: 1.5rem;
|
|
14
16
|
white-space: pre;
|
|
15
17
|
font-family: monospace;
|