highmark-markdown 1.0.41 → 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.
Files changed (53) hide show
  1. package/example.js +3151 -1252
  2. package/lib/example/customEventTypes.js +17 -1
  3. package/lib/example/importer.js +2 -6
  4. package/lib/example/view/{div/sizeable/right.js → button/tab/css.js} +44 -33
  5. package/lib/example/view/button/tab/html.js +146 -0
  6. package/lib/example/view/button/tab/markdown.js +2 -23
  7. package/lib/example/view/button/tab/markdownStyle.js +2 -23
  8. package/lib/example/view/button/tab/plainText.js +146 -0
  9. package/lib/example/view/button/tab/preview.js +146 -0
  10. package/lib/example/view/button/tab.js +2 -2
  11. package/lib/example/view/div/container/css.js +186 -0
  12. package/lib/example/view/div/container/html.js +188 -0
  13. package/lib/example/view/div/container/plainText.js +186 -0
  14. package/lib/example/view/div/container/preview.js +212 -0
  15. package/lib/example/view/div/container.js +2 -2
  16. package/lib/example/view/div/preview.js +2 -2
  17. package/lib/example/view/div/tabButtons/left.js +206 -0
  18. package/lib/example/view/div/tabButtons/right.js +246 -0
  19. package/lib/example/view/div/tabButtons.js +3 -59
  20. package/lib/example/view/textarea/css.js +2 -2
  21. package/lib/example/view/textarea/plainText.js +183 -0
  22. package/lib/example/view/textarea.js +2 -2
  23. package/lib/example/view.js +99 -47
  24. package/lib/node/markdown/tableBodyCell.js +8 -1
  25. package/lib/node/markdown/tableHeadCell.js +8 -1
  26. package/package.json +5 -5
  27. package/src/example/customEventTypes.js +4 -0
  28. package/src/example/importer.js +1 -5
  29. package/src/example/view/button/tab/css.js +23 -0
  30. package/src/example/view/button/tab/html.js +23 -0
  31. package/src/example/view/button/tab/markdown.js +1 -15
  32. package/src/example/view/button/tab/markdownStyle.js +1 -13
  33. package/src/example/view/button/tab/plainText.js +23 -0
  34. package/src/example/view/button/tab/preview.js +23 -0
  35. package/src/example/view/button/tab.js +4 -5
  36. package/src/example/view/div/container/css.js +30 -0
  37. package/src/example/view/div/container/html.js +30 -0
  38. package/src/example/view/div/container/plainText.js +30 -0
  39. package/src/example/view/div/container/preview.js +43 -0
  40. package/src/example/view/div/container.js +0 -3
  41. package/src/example/view/div/preview.js +1 -2
  42. package/src/example/view/div/tabButtons/left.js +66 -0
  43. package/src/example/view/div/tabButtons/right.js +106 -0
  44. package/src/example/view/div/tabButtons.js +0 -49
  45. package/src/example/view/textarea/css.js +1 -1
  46. package/src/example/view/textarea/plainText.js +46 -0
  47. package/src/example/view/textarea.js +2 -0
  48. package/src/example/view.js +112 -71
  49. package/src/node/markdown/tableBodyCell.js +9 -0
  50. package/src/node/markdown/tableHeadCell.js +9 -0
  51. package/lib/example/view/subHeading.js +0 -39
  52. package/src/example/view/div/sizeable/right.js +0 -19
  53. package/src/example/view/subHeading.js +0 -16
@@ -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
+ `;
@@ -23,10 +23,7 @@ class ContainerDiv extends Element {
23
23
  export default withStyle(ContainerDiv)`
24
24
 
25
25
  border: 1px solid black;
26
- display: flex;
27
26
  padding: 1rem;
28
27
  border-top: 0;
29
- align-items: stretch;
30
- flex-direction: column;
31
28
 
32
29
  `;
@@ -101,8 +101,7 @@ class PreviewDiv extends Element {
101
101
 
102
102
  export default withStyle(PreviewDiv)`
103
103
 
104
- height: 48rem;
105
- border: 1px solid darkgrey;
104
+ height: 100%;
106
105
  overflow: scroll;
107
106
  position: relative;
108
107
 
@@ -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
  `;
@@ -28,6 +28,6 @@ class CSSTextarea extends Textarea {
28
28
 
29
29
  export default withStyle(CSSTextarea)`
30
30
 
31
- height: 16rem;
31
+ height: 48rem;
32
32
 
33
33
  `;
@@ -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;