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.
- package/example.js +3151 -1252
- 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/example/customEventTypes.js +4 -0
- package/src/example/importer.js +1 -5
- 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/example/view.js
CHANGED
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
import withStyle from "easy-with-style"; ///
|
|
4
4
|
|
|
5
5
|
import { Element } from "easy";
|
|
6
|
+
import { RowsDiv, ColumnDiv, ColumnsDiv, VerticalSplitterDiv } from "easy-layout";
|
|
6
7
|
import { MarkdownLexer, MarkdownParser, MarkdownStyleLexer, MarkdownStyleParser } from "../index";
|
|
7
|
-
import { RowDiv, RowsDiv, ColumnDiv, ColumnsDiv, VerticalSplitterDiv, HorizontalSplitterDiv } from "easy-layout";
|
|
8
8
|
|
|
9
|
-
import HTMLDiv from "./view/div/html";
|
|
10
9
|
import importer from "./importer";
|
|
11
|
-
import PreviewDiv from "./view/div/preview";
|
|
12
|
-
import SubHeading from "./view/subHeading";
|
|
13
|
-
import CSSTextarea from "./view/textarea/css";
|
|
14
10
|
import indexOptions from "./indexOptions";
|
|
15
|
-
import TabButtonsDiv from "./view/div/tabButtons";
|
|
16
11
|
import LeftSizeableDiv from "./view/div/sizeable/left";
|
|
17
|
-
import
|
|
12
|
+
import CSSContainerDiv from "./view/div/container/css";
|
|
13
|
+
import HTMLContainerDiv from "./view/div/container/html";
|
|
14
|
+
import LeftTabButtonsDiv from "./view/div/tabButtons/left";
|
|
15
|
+
import RightTabButtonsDiv from "./view/div/tabButtons/right";
|
|
16
|
+
import PreviewContainerDiv from "./view/div/container/preview";
|
|
18
17
|
import MarkdownContainerDiv from "./view/div/container/markdown";
|
|
18
|
+
import PlainTextContainerDiv from "./view/div/container/plainText";
|
|
19
19
|
import MarkdownStyleContainerDiv from "./view/div/container/markdownStyle";
|
|
20
20
|
|
|
21
21
|
import { defaultContent } from "./importer";
|
|
@@ -38,36 +38,58 @@ class View extends Element {
|
|
|
38
38
|
this.updatePage(index);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
plainTextCustomHandler = (event, element) => {
|
|
42
|
+
this.plainText();
|
|
43
|
+
}
|
|
44
|
+
|
|
41
45
|
markdownCustomHandler = (event, element) => {
|
|
42
46
|
this.markdown();
|
|
43
47
|
}
|
|
44
48
|
|
|
49
|
+
previewCustomHandler = (event, element) => {
|
|
50
|
+
this.preview();
|
|
51
|
+
}
|
|
52
|
+
|
|
45
53
|
keyUpCustomHandler = (event, element) => {
|
|
46
54
|
this.update();
|
|
47
55
|
}
|
|
48
56
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
css = markdownStyleElement.update(markdownStyle);
|
|
57
|
+
htmlCustomHandler = (event, element) => {
|
|
58
|
+
this.html();
|
|
59
|
+
}
|
|
53
60
|
|
|
54
|
-
|
|
61
|
+
cssCustomHandler = (event, element) => {
|
|
62
|
+
this.css();
|
|
63
|
+
}
|
|
55
64
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
startRule = parser.getStartRule(),
|
|
61
|
-
startOfContent = true,
|
|
62
|
-
node = parser.parse(tokens, startRule, startOfContent);
|
|
65
|
+
update() {
|
|
66
|
+
this.updateMarkdown();
|
|
67
|
+
this.updateMarkdownStyle();
|
|
68
|
+
}
|
|
63
69
|
|
|
64
|
-
|
|
65
|
-
|
|
70
|
+
clearPage() {
|
|
71
|
+
this.clearXMP();
|
|
72
|
+
this.clearPreviewDiv();
|
|
73
|
+
}
|
|
66
74
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
75
|
+
updatePage(index) {
|
|
76
|
+
const divisionMarkdownNodes = this.getDivisionMarkdownNodes(),
|
|
77
|
+
divisionMarkdownNode = divisionMarkdownNodes[index],
|
|
78
|
+
tokens = this.getTokens(),
|
|
79
|
+
context = {
|
|
80
|
+
tokens
|
|
81
|
+
},
|
|
82
|
+
length = null,
|
|
83
|
+
html = divisionMarkdownNode.asHTML(context),
|
|
84
|
+
plainText = divisionMarkdownNode.asPlainText(context);
|
|
85
|
+
|
|
86
|
+
this.updateXMP(html);
|
|
87
|
+
|
|
88
|
+
this.updatePreviewDiv(divisionMarkdownNode, context);
|
|
89
|
+
|
|
90
|
+
this.updatePageButtonsDiv(length, index);
|
|
91
|
+
|
|
92
|
+
this.updatePlainTextTextarea(plainText);
|
|
71
93
|
}
|
|
72
94
|
|
|
73
95
|
updateMarkdown() {
|
|
@@ -97,11 +119,8 @@ class View extends Element {
|
|
|
97
119
|
tokensFromContent,
|
|
98
120
|
charactersPerLine
|
|
99
121
|
},
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
divisionMarkdownNodes = [
|
|
103
|
-
divisionMarkdownNode
|
|
104
|
-
];
|
|
122
|
+
markdownNodes = postprocess(divisionMarkdownNode, context),
|
|
123
|
+
divisionMarkdownNodes = divisionMarkdownNodesFromMarkdownNodes(markdownNodes);
|
|
105
124
|
|
|
106
125
|
this.setDivisionMarkdownNodes(divisionMarkdownNodes);
|
|
107
126
|
|
|
@@ -122,6 +141,8 @@ class View extends Element {
|
|
|
122
141
|
|
|
123
142
|
this.clearPageButtonsDiv();
|
|
124
143
|
|
|
144
|
+
this.clearPlainTextTextarea();
|
|
145
|
+
|
|
125
146
|
this.clearMarkdownParseTreeTextarea();
|
|
126
147
|
|
|
127
148
|
const divisionMarkdownNodes = null;
|
|
@@ -130,27 +151,28 @@ class View extends Element {
|
|
|
130
151
|
}
|
|
131
152
|
}
|
|
132
153
|
|
|
133
|
-
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
context = {
|
|
138
|
-
tokens
|
|
139
|
-
},
|
|
140
|
-
length = null,
|
|
141
|
-
html = divisionMarkdownNode.asHTML(context);
|
|
142
|
-
|
|
143
|
-
this.updateXMP(html);
|
|
154
|
+
updateMarkdownStyle() {
|
|
155
|
+
const { markdownStyleElement } = this.properties,
|
|
156
|
+
markdownStyle = this.getMarkdownStyle(),
|
|
157
|
+
css = markdownStyleElement.update(markdownStyle);
|
|
144
158
|
|
|
145
|
-
this.
|
|
159
|
+
this.setCSS(css);
|
|
146
160
|
|
|
147
|
-
|
|
148
|
-
|
|
161
|
+
const lexer = markdownStyleLexer, ///
|
|
162
|
+
parser = markdownStyleParser, ///
|
|
163
|
+
content = markdownStyle, ///
|
|
164
|
+
tokens = lexer.tokenise(content),
|
|
165
|
+
startRule = parser.getStartRule(),
|
|
166
|
+
startOfContent = true,
|
|
167
|
+
node = parser.parse(tokens, startRule, startOfContent);
|
|
149
168
|
|
|
150
|
-
|
|
151
|
-
|
|
169
|
+
if (node !== null) {
|
|
170
|
+
const parseTree = node.asParseTree(tokens);
|
|
152
171
|
|
|
153
|
-
|
|
172
|
+
this.updateMarkdownStyleParseTreeTextarea(parseTree);
|
|
173
|
+
} else {
|
|
174
|
+
this.clearMarkdownStyleParseTreeTextarea();
|
|
175
|
+
}
|
|
154
176
|
}
|
|
155
177
|
|
|
156
178
|
markdownStyle() {
|
|
@@ -158,14 +180,37 @@ class View extends Element {
|
|
|
158
180
|
this.showMarkdownStyleContainerDiv();
|
|
159
181
|
}
|
|
160
182
|
|
|
183
|
+
plainText() {
|
|
184
|
+
this.hideCSSContainerDiv();
|
|
185
|
+
this.hideHTMLContainerDiv();
|
|
186
|
+
this.hidePreviewContainerDiv();
|
|
187
|
+
this.showPlainTextContainerDiv();
|
|
188
|
+
}
|
|
189
|
+
|
|
161
190
|
markdown() {
|
|
162
191
|
this.showMarkdownContainerDiv();
|
|
163
192
|
this.hideMarkdownStyleContainerDiv();
|
|
164
193
|
}
|
|
165
194
|
|
|
166
|
-
|
|
167
|
-
this.
|
|
168
|
-
this.
|
|
195
|
+
preview() {
|
|
196
|
+
this.hideCSSContainerDiv();
|
|
197
|
+
this.hideHTMLContainerDiv();
|
|
198
|
+
this.showPreviewContainerDiv();
|
|
199
|
+
this.hidePlainTextContainerDiv();
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
html() {
|
|
203
|
+
this.hideCSSContainerDiv();
|
|
204
|
+
this.showHTMLContainerDiv();
|
|
205
|
+
this.hidePreviewContainerDiv();
|
|
206
|
+
this.hidePlainTextContainerDiv();
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
css() {
|
|
210
|
+
this.showCSSContainerDiv();
|
|
211
|
+
this.hideHTMLContainerDiv();
|
|
212
|
+
this.hidePreviewContainerDiv();
|
|
213
|
+
this.hidePlainTextContainerDiv();
|
|
169
214
|
}
|
|
170
215
|
|
|
171
216
|
getTokens() {
|
|
@@ -207,32 +252,22 @@ class View extends Element {
|
|
|
207
252
|
|
|
208
253
|
<ColumnsDiv>
|
|
209
254
|
<LeftSizeableDiv>
|
|
210
|
-
<
|
|
255
|
+
<LeftTabButtonsDiv onCustomMarkdown={this.markdownCustomHandler} onCustomMarkdownStyle={this.markdownStyleCustomHandler} />
|
|
211
256
|
<MarkdownContainerDiv onCustomKeyUp={this.keyUpCustomHandler} />
|
|
212
257
|
<MarkdownStyleContainerDiv onCustomKeyUp={this.keyUpCustomHandler} />
|
|
213
258
|
</LeftSizeableDiv>
|
|
214
259
|
<VerticalSplitterDiv/>
|
|
215
260
|
<ColumnDiv>
|
|
216
261
|
<RowsDiv>
|
|
217
|
-
<
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
<
|
|
224
|
-
<
|
|
225
|
-
|
|
226
|
-
<SubHeading>
|
|
227
|
-
CSS
|
|
228
|
-
</SubHeading>
|
|
229
|
-
<CSSTextarea/>
|
|
230
|
-
<SubHeading>
|
|
231
|
-
Preview
|
|
232
|
-
</SubHeading>
|
|
233
|
-
<PreviewDiv onCustomPageUpdate={this.pageUpdateCustomHandler} />
|
|
234
|
-
</RowsDiv>
|
|
235
|
-
</RowDiv>
|
|
262
|
+
<RightTabButtonsDiv onCustomCSS={this.cssCustomHandler}
|
|
263
|
+
onCustomHTML={this.htmlCustomHandler}
|
|
264
|
+
onCustomPreview={this.previewCustomHandler}
|
|
265
|
+
onCustomPlainText={this.plainTextCustomHandler}
|
|
266
|
+
/>
|
|
267
|
+
<CSSContainerDiv/>
|
|
268
|
+
<HTMLContainerDiv/>
|
|
269
|
+
<PreviewContainerDiv onCustomPageUpdate={this.pageUpdateCustomHandler} />
|
|
270
|
+
<PlainTextContainerDiv/>
|
|
236
271
|
</RowsDiv>
|
|
237
272
|
</ColumnDiv>
|
|
238
273
|
</ColumnsDiv>
|
|
@@ -254,6 +289,8 @@ class View extends Element {
|
|
|
254
289
|
this.setMarkdownStyle(markdownStyle);
|
|
255
290
|
|
|
256
291
|
this.update();
|
|
292
|
+
|
|
293
|
+
this.css();
|
|
257
294
|
}
|
|
258
295
|
|
|
259
296
|
static tagName = "div";
|
|
@@ -268,10 +305,14 @@ class View extends Element {
|
|
|
268
305
|
|
|
269
306
|
static initialMarkdown = defaultContent; ///
|
|
270
307
|
|
|
271
|
-
static initialMarkdownStyle = `
|
|
308
|
+
static initialMarkdownStyle = `
|
|
309
|
+
|
|
310
|
+
width: 100%;
|
|
311
|
+
height: 199%;
|
|
272
312
|
position: absolute;
|
|
273
313
|
min-height: 100%;
|
|
274
314
|
padding-top: 5rem;
|
|
315
|
+
|
|
275
316
|
`;
|
|
276
317
|
}
|
|
277
318
|
|
|
@@ -16,5 +16,14 @@ export default class TableBodyCellMarkdownNode extends MarkdownNode {
|
|
|
16
16
|
return childNodesHTML;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
childNodesAsPlainText(indent, context) {
|
|
20
|
+
const childNodes = this.getChildNodes(),
|
|
21
|
+
firstChildNode = first(childNodes),
|
|
22
|
+
tableCellMarkdownNode = firstChildNode, ///
|
|
23
|
+
childNodesPlainText = tableCellMarkdownNode.childNodesAsPlainText(indent, context);
|
|
24
|
+
|
|
25
|
+
return childNodesPlainText;
|
|
26
|
+
}
|
|
27
|
+
|
|
19
28
|
static fromRuleNameChildNodesAndOpacity(ruleName, childNodes, opacity) { return MarkdownNode.fromRuleNameChildNodesAndOpacity(TableBodyCellMarkdownNode, ruleName, childNodes, opacity); }
|
|
20
29
|
}
|
|
@@ -16,5 +16,14 @@ export default class TableHeadCellMarkdownNode extends MarkdownNode {
|
|
|
16
16
|
return childNodesHTML;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
childNodesAsPlainText(indent, context) {
|
|
20
|
+
const childNodes = this.getChildNodes(),
|
|
21
|
+
firstChildNode = first(childNodes),
|
|
22
|
+
tableCellMarkdownNode = firstChildNode, ///
|
|
23
|
+
childNodesPlainText = tableCellMarkdownNode.childNodesAsPlainText(indent, context);
|
|
24
|
+
|
|
25
|
+
return childNodesPlainText;
|
|
26
|
+
}
|
|
27
|
+
|
|
19
28
|
static fromRuleNameChildNodesAndOpacity(ruleName, childNodes, opacity) { return MarkdownNode.fromRuleNameChildNodesAndOpacity(TableHeadCellMarkdownNode, ruleName, childNodes, opacity); }
|
|
20
29
|
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return _default;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var _easywithstyle = /*#__PURE__*/ _interop_require_default(require("easy-with-style"));
|
|
12
|
-
function _interop_require_default(obj) {
|
|
13
|
-
return obj && obj.__esModule ? obj : {
|
|
14
|
-
default: obj
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function _tagged_template_literal(strings, raw) {
|
|
18
|
-
if (!raw) {
|
|
19
|
-
raw = strings.slice(0);
|
|
20
|
-
}
|
|
21
|
-
return Object.freeze(Object.defineProperties(strings, {
|
|
22
|
-
raw: {
|
|
23
|
-
value: Object.freeze(raw)
|
|
24
|
-
}
|
|
25
|
-
}));
|
|
26
|
-
}
|
|
27
|
-
function _templateObject() {
|
|
28
|
-
var data = _tagged_template_literal([
|
|
29
|
-
"\n\n margin: 1rem 0 0.5rem 0;\n font-size: 2rem;\n \n :first-of-type {\n margin-top: 0;\n }\n\n"
|
|
30
|
-
]);
|
|
31
|
-
_templateObject = function _templateObject() {
|
|
32
|
-
return data;
|
|
33
|
-
};
|
|
34
|
-
return data;
|
|
35
|
-
}
|
|
36
|
-
var SubHeading = _easywithstyle.default.h2(_templateObject());
|
|
37
|
-
var _default = SubHeading;
|
|
38
|
-
|
|
39
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9leGFtcGxlL3ZpZXcvc3ViSGVhZGluZy5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcblxuaW1wb3J0IHdpdGhTdHlsZSBmcm9tIFwiZWFzeS13aXRoLXN0eWxlXCI7ICAvLy9cblxuY29uc3QgU3ViSGVhZGluZyA9IHdpdGhTdHlsZS5oMmBcblxuICBtYXJnaW46IDFyZW0gMCAwLjVyZW0gMDtcbiAgZm9udC1zaXplOiAycmVtO1xuICBcbiAgOmZpcnN0LW9mLXR5cGUge1xuICAgIG1hcmdpbi10b3A6IDA7XG4gIH1cblxuYDtcblxuZXhwb3J0IGRlZmF1bHQgU3ViSGVhZGluZztcbiJdLCJuYW1lcyI6WyJTdWJIZWFkaW5nIiwid2l0aFN0eWxlIiwiaDIiXSwibWFwcGluZ3MiOiJBQUFBOzs7OytCQWVBOzs7ZUFBQTs7O29FQWJzQjs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUV0QixJQUFNQSxhQUFhQyxzQkFBUyxDQUFDQyxFQUFFO0lBVy9CLFdBQWVGIn0=
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import withStyle from "easy-with-style"; ///
|
|
4
|
-
|
|
5
|
-
import { SizeableDiv } from "easy-layout";
|
|
6
|
-
|
|
7
|
-
class RightSizeableDiv extends SizeableDiv {
|
|
8
|
-
static defaultProperties = {
|
|
9
|
-
className: "right"
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default withStyle(RightSizeableDiv)`
|
|
14
|
-
|
|
15
|
-
height: 32rem;
|
|
16
|
-
min-width: 1rem;
|
|
17
|
-
flex-direction: column;
|
|
18
|
-
|
|
19
|
-
`;
|