@pie-lib/mask-markup 2.0.0-beta.2 → 2.0.0-next.0
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/CHANGELOG.json +1 -871
- package/CHANGELOG.md +296 -2
- package/LICENSE.md +5 -0
- package/NEXT.CHANGELOG.json +1 -0
- package/lib/choices/choice.js +99 -118
- package/lib/choices/choice.js.map +1 -1
- package/lib/choices/index.js +23 -19
- package/lib/choices/index.js.map +1 -1
- package/lib/componentize.js +1 -2
- package/lib/componentize.js.map +1 -1
- package/lib/components/blank.js +315 -221
- package/lib/components/blank.js.map +1 -1
- package/lib/components/correct-input.js +39 -42
- package/lib/components/correct-input.js.map +1 -1
- package/lib/components/dropdown.js +393 -124
- package/lib/components/dropdown.js.map +1 -1
- package/lib/components/input.js +1 -2
- package/lib/components/input.js.map +1 -1
- package/lib/constructed-response.js +82 -26
- package/lib/constructed-response.js.map +1 -1
- package/lib/customizable.js +44 -0
- package/lib/customizable.js.map +1 -0
- package/lib/drag-in-the-blank.js +154 -61
- package/lib/drag-in-the-blank.js.map +1 -1
- package/lib/index.js +7 -0
- package/lib/index.js.map +1 -1
- package/lib/inline-dropdown.js +4 -3
- package/lib/inline-dropdown.js.map +1 -1
- package/lib/mask.js +89 -56
- package/lib/mask.js.map +1 -1
- package/lib/serialization.js +30 -42
- package/lib/serialization.js.map +1 -1
- package/lib/with-mask.js +48 -20
- package/lib/with-mask.js.map +1 -1
- package/package.json +26 -15
- package/src/__tests__/drag-in-the-blank.test.js +111 -0
- package/src/__tests__/index.test.js +39 -0
- package/src/__tests__/mask.test.js +187 -0
- package/src/__tests__/serialization.test.js +54 -0
- package/src/__tests__/utils.js +1 -0
- package/src/__tests__/with-mask.test.js +76 -0
- package/src/choices/__tests__/index.test.js +75 -0
- package/src/choices/choice.jsx +83 -96
- package/src/choices/index.jsx +11 -5
- package/src/components/__tests__/blank.test.js +138 -0
- package/src/components/__tests__/correct-input.test.js +90 -0
- package/src/components/__tests__/dropdown.test.js +93 -0
- package/src/components/__tests__/input.test.js +102 -0
- package/src/components/blank.jsx +316 -204
- package/src/components/correct-input.jsx +37 -38
- package/src/components/dropdown.jsx +371 -125
- package/src/constructed-response.jsx +80 -18
- package/src/customizable.jsx +35 -0
- package/src/drag-in-the-blank.jsx +152 -40
- package/src/index.js +10 -1
- package/src/inline-dropdown.jsx +2 -0
- package/src/mask.jsx +71 -25
- package/src/serialization.js +22 -34
- package/src/with-mask.jsx +43 -3
- package/README.md +0 -14
- package/lib/new-serialization.js +0 -267
- package/lib/new-serialization.js.map +0 -1
- package/lib/parse-html.js +0 -17
- package/lib/parse-html.js.map +0 -1
- package/lib/test-serializer.js +0 -164
- package/lib/test-serializer.js.map +0 -1
- package/src/new-serialization.jsx +0 -291
- package/src/parse-html.js +0 -8
- package/src/test-serializer.js +0 -163
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
import TestSerializer from './test-serializer';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import debug from 'debug';
|
|
4
|
-
import { object as toStyleObject } from 'to-style';
|
|
5
|
-
|
|
6
|
-
import { serialization as imgSerialization } from './plugins/image';
|
|
7
|
-
import { serialization as mathSerialization } from './plugins/math';
|
|
8
|
-
import { serialization as mediaSerialization } from './plugins/media';
|
|
9
|
-
import { serialization as listSerialization } from './plugins/list';
|
|
10
|
-
import { serialization as tableSerialization } from './plugins/table';
|
|
11
|
-
import { serialization as responseAreaSerialization } from './plugins/respArea';
|
|
12
|
-
import { Mark, Value } from 'slate';
|
|
13
|
-
import { jsx } from 'slate-hyperscript';
|
|
14
|
-
|
|
15
|
-
const log = debug('@pie-lib:editable-html:serialization');
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Tags to blocks.
|
|
19
|
-
*
|
|
20
|
-
* @type {Object}
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
export const BLOCK_TAGS = {
|
|
24
|
-
div: 'div',
|
|
25
|
-
span: 'span',
|
|
26
|
-
p: 'paragraph',
|
|
27
|
-
blockquote: 'quote',
|
|
28
|
-
pre: 'code',
|
|
29
|
-
h1: 'heading-one',
|
|
30
|
-
h2: 'heading-two',
|
|
31
|
-
h3: 'heading-three',
|
|
32
|
-
h4: 'heading-four',
|
|
33
|
-
h5: 'heading-five',
|
|
34
|
-
h6: 'heading-six',
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Tags to marks.
|
|
39
|
-
*
|
|
40
|
-
* @type {Object}
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
const MARK_TAGS = {
|
|
44
|
-
b: 'bold',
|
|
45
|
-
em: 'italic',
|
|
46
|
-
u: 'underline',
|
|
47
|
-
s: 'strikethrough',
|
|
48
|
-
code: 'code',
|
|
49
|
-
strong: 'bold',
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export const parseStyleString = (s) => {
|
|
53
|
-
const regex = /([\w-]*)\s*:\s*([^;]*)/g;
|
|
54
|
-
let match;
|
|
55
|
-
const result = {};
|
|
56
|
-
while ((match = regex.exec(s))) {
|
|
57
|
-
result[match[1]] = match[2].trim();
|
|
58
|
-
}
|
|
59
|
-
return result;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export const getBase64 = (file) => {
|
|
63
|
-
return new Promise((resolve, reject) => {
|
|
64
|
-
const reader = new FileReader();
|
|
65
|
-
reader.readAsDataURL(file);
|
|
66
|
-
reader.onload = () => resolve(reader.result);
|
|
67
|
-
reader.onerror = (error) => reject(error);
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export const reactAttributes = (o) => toStyleObject(o, { camelize: true, addUnits: false });
|
|
72
|
-
|
|
73
|
-
const attributesToMap = (el) => (acc, attribute) => {
|
|
74
|
-
const value = el.getAttribute(attribute);
|
|
75
|
-
if (value) {
|
|
76
|
-
if (attribute === 'style') {
|
|
77
|
-
const styleString = el.getAttribute(attribute);
|
|
78
|
-
const reactStyleObject = reactAttributes(parseStyleString(styleString));
|
|
79
|
-
acc['style'] = reactStyleObject;
|
|
80
|
-
} else {
|
|
81
|
-
acc[attribute] = el.getAttribute(attribute);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return acc;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const attributes = ['border', 'cellpadding', 'cellspacing', 'class', 'style'];
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Serializer rules.
|
|
91
|
-
*
|
|
92
|
-
* @type {Array}
|
|
93
|
-
*/
|
|
94
|
-
|
|
95
|
-
const blocks = {
|
|
96
|
-
deserialize(el, next) {
|
|
97
|
-
log('[blocks:deserialize] block: ', el);
|
|
98
|
-
const block = BLOCK_TAGS[el.tagName.toLowerCase()];
|
|
99
|
-
if (!block) return;
|
|
100
|
-
log('[blocks:deserialize] block: ', block);
|
|
101
|
-
|
|
102
|
-
if (el.childNodes.length === 1) {
|
|
103
|
-
const cn = el.childNodes[0];
|
|
104
|
-
if (cn && cn.tagName && cn.tagName.toLowerCase() === block) {
|
|
105
|
-
log('[we have a child node of the same]...');
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return jsx(
|
|
111
|
-
'element',
|
|
112
|
-
{
|
|
113
|
-
type: block,
|
|
114
|
-
/**
|
|
115
|
-
* Here for rendering styles for all block elements
|
|
116
|
-
*/
|
|
117
|
-
data: { attributes: attributes.reduce(attributesToMap(el), {}) },
|
|
118
|
-
},
|
|
119
|
-
next(el.childNodes),
|
|
120
|
-
);
|
|
121
|
-
},
|
|
122
|
-
serialize: (object, children) => {
|
|
123
|
-
if (object.object !== 'block') return;
|
|
124
|
-
|
|
125
|
-
const jsonData = object.data.toJSON();
|
|
126
|
-
|
|
127
|
-
log('[blocks:serialize] object: ', object, children);
|
|
128
|
-
let key;
|
|
129
|
-
|
|
130
|
-
for (key in BLOCK_TAGS) {
|
|
131
|
-
if (BLOCK_TAGS[key] === object.type) {
|
|
132
|
-
const Tag = key;
|
|
133
|
-
|
|
134
|
-
return <Tag {...jsonData.attributes}>{children}</Tag>;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
const marks = {
|
|
141
|
-
deserialize(el, next) {
|
|
142
|
-
const mark = MARK_TAGS[el.tagName.toLowerCase()];
|
|
143
|
-
if (!mark) {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
log('[deserialize] mark: ', mark);
|
|
147
|
-
|
|
148
|
-
return jsx('element', { type: mark }, next(el.childNodes));
|
|
149
|
-
},
|
|
150
|
-
serialize(object, children) {
|
|
151
|
-
/*if (Mark.isMark(object)) {
|
|
152
|
-
for (var key in MARK_TAGS) {
|
|
153
|
-
if (MARK_TAGS[key] === object.type) {
|
|
154
|
-
const Tag = key;
|
|
155
|
-
return <Tag>{children}</Tag>;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}*/
|
|
159
|
-
},
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
const findPreviousText = (el) => {
|
|
163
|
-
if (el.nodeName === '#text') {
|
|
164
|
-
return el;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if (el.previousSibling) {
|
|
168
|
-
return findPreviousText(el.previousSibling);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
return null;
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
export const TEXT_RULE = {
|
|
175
|
-
deserialize(el) {
|
|
176
|
-
/**
|
|
177
|
-
* This needs to be called on the dom element in order to merge the adjacent text nodes together
|
|
178
|
-
* */
|
|
179
|
-
el.normalize();
|
|
180
|
-
|
|
181
|
-
if (el.tagName && el.tagName.toLowerCase() === 'br') {
|
|
182
|
-
return jsx('text', {});
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
if (el.nodeName === '#text') {
|
|
186
|
-
if (el.nodeValue && el.nodeValue.match(/<!--.*?-->/)) return;
|
|
187
|
-
|
|
188
|
-
log('[text:deserialize] return text object..');
|
|
189
|
-
return jsx('text', {}, el.nodeValue);
|
|
190
|
-
}
|
|
191
|
-
},
|
|
192
|
-
|
|
193
|
-
serialize(obj, children) {
|
|
194
|
-
if (obj.object === 'string') {
|
|
195
|
-
return children.split('\n').reduce((array, text, i) => {
|
|
196
|
-
if (i !== 0) array.push(<br />);
|
|
197
|
-
array.push(text);
|
|
198
|
-
return array;
|
|
199
|
-
}, []);
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
const RULES = [
|
|
205
|
-
listSerialization,
|
|
206
|
-
mathSerialization,
|
|
207
|
-
mediaSerialization,
|
|
208
|
-
imgSerialization,
|
|
209
|
-
tableSerialization,
|
|
210
|
-
responseAreaSerialization,
|
|
211
|
-
TEXT_RULE,
|
|
212
|
-
blocks,
|
|
213
|
-
marks,
|
|
214
|
-
];
|
|
215
|
-
|
|
216
|
-
function allWhitespace(node) {
|
|
217
|
-
// Use ECMA-262 Edition 3 String and RegExp features
|
|
218
|
-
return !/[^\t\n\r ]/.test(node.textContent);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
function defaultParseHtml(html) {
|
|
222
|
-
if (typeof DOMParser === 'undefined') {
|
|
223
|
-
throw new Error(
|
|
224
|
-
'The native `DOMParser` global which the `Html` serializer uses by default is not present in this environment. You must supply the `options.parseHtml` function instead.',
|
|
225
|
-
);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
const parsed = new DOMParser().parseFromString(html, 'text/html');
|
|
229
|
-
|
|
230
|
-
const { body } = parsed;
|
|
231
|
-
const textNodes = document.createTreeWalker(body, NodeFilter.SHOW_TEXT, null, null);
|
|
232
|
-
let n = textNodes.nextNode();
|
|
233
|
-
|
|
234
|
-
while (n) {
|
|
235
|
-
if (allWhitespace(n) || n.nodeValue === '\u200B') {
|
|
236
|
-
n.parentNode.removeChild(n);
|
|
237
|
-
}
|
|
238
|
-
n = textNodes.nextNode();
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
return body;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
/** If this lib is used on the server side, we need to bypass using the DOMParser - just put in a stub. */
|
|
245
|
-
const parseHtml =
|
|
246
|
-
typeof window === 'undefined'
|
|
247
|
-
? () => ({
|
|
248
|
-
childNodes: [],
|
|
249
|
-
})
|
|
250
|
-
: defaultParseHtml;
|
|
251
|
-
|
|
252
|
-
const serializer = new TestSerializer({
|
|
253
|
-
defaultBlock: 'div',
|
|
254
|
-
rules: RULES,
|
|
255
|
-
parseHtml,
|
|
256
|
-
});
|
|
257
|
-
|
|
258
|
-
const _extends =
|
|
259
|
-
Object.assign ||
|
|
260
|
-
function(target) {
|
|
261
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
262
|
-
var source = arguments[i];
|
|
263
|
-
|
|
264
|
-
for (var key in source) {
|
|
265
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
266
|
-
target[key] = source[key];
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
return target;
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
export const htmlToValue = (html) => {
|
|
275
|
-
try {
|
|
276
|
-
return serializer.deserialize(html);
|
|
277
|
-
} catch (e) {
|
|
278
|
-
console.log("Couldn't parse html: ", e);
|
|
279
|
-
return {};
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
export const valueToHtml = (value) => serializer.serialize(value);
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
*
|
|
287
|
-
* <div><div>a</div></div> -> <div>a</div>
|
|
288
|
-
*
|
|
289
|
-
* <div><div>a</div><div>b</div></div> -> <div>a</div><div>b</div>
|
|
290
|
-
* <div><div>a</div>4444<div>b</div></div> -> <div>a</div>4444<div>b</div>
|
|
291
|
-
*/
|
package/src/parse-html.js
DELETED
package/src/test-serializer.js
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ReactServer from 'react-dom/server';
|
|
3
|
-
import escapeHtml from 'escape-html';
|
|
4
|
-
import { Text } from 'slate';
|
|
5
|
-
import { jsx } from 'slate-hyperscript';
|
|
6
|
-
|
|
7
|
-
function allWhitespace(node) {
|
|
8
|
-
// Use ECMA-262 Edition 3 String and RegExp features
|
|
9
|
-
return !/[^\t\n\r ]/.test(node.textContent);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function defaultParseHtml(html) {
|
|
13
|
-
if (typeof DOMParser === 'undefined') {
|
|
14
|
-
throw new Error(
|
|
15
|
-
'The native `DOMParser` global which the `Html` serializer uses by default is not present in this environment. You must supply the `options.parseHtml` function instead.',
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const parsed = new DOMParser().parseFromString(html, 'text/html');
|
|
20
|
-
|
|
21
|
-
const { body } = parsed;
|
|
22
|
-
const textNodes = document.createTreeWalker(body, NodeFilter.SHOW_TEXT, null, null);
|
|
23
|
-
let n = textNodes.nextNode();
|
|
24
|
-
|
|
25
|
-
while (n) {
|
|
26
|
-
if (allWhitespace(n) || n.nodeValue === '\u200B') {
|
|
27
|
-
n.parentNode.removeChild(n);
|
|
28
|
-
}
|
|
29
|
-
n = textNodes.nextNode();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return body;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
class Html {
|
|
36
|
-
constructor(props) {
|
|
37
|
-
this.defaultBlock = props.defaultBlock;
|
|
38
|
-
this.parseHtml = defaultParseHtml;
|
|
39
|
-
this.rules = props.rules;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
serializeEls = (node) => {
|
|
43
|
-
if (Text.isText(node)) {
|
|
44
|
-
let string = escapeHtml(node.text);
|
|
45
|
-
if (node.bold) {
|
|
46
|
-
string = <strong>{string}</strong>;
|
|
47
|
-
}
|
|
48
|
-
return string;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
let children = (node.children || []).map((n) => this.serializeEls(n));
|
|
52
|
-
|
|
53
|
-
const correctRule = this.rules.reduce((res, rule) => {
|
|
54
|
-
return res || rule.serialize(node, children);
|
|
55
|
-
}, null);
|
|
56
|
-
|
|
57
|
-
if (correctRule) {
|
|
58
|
-
return correctRule;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
switch (node.type) {
|
|
62
|
-
case 'quote':
|
|
63
|
-
return (
|
|
64
|
-
<blockquote>
|
|
65
|
-
<p>{children}</p>
|
|
66
|
-
</blockquote>
|
|
67
|
-
);
|
|
68
|
-
case 'paragraph':
|
|
69
|
-
return <p>{children}</p>;
|
|
70
|
-
case 'link':
|
|
71
|
-
return <a href={escapeHtml(node.url)}>{children}</a>;
|
|
72
|
-
default:
|
|
73
|
-
return children;
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
serialize = (node) => {
|
|
78
|
-
const deserialized = this.serializeEls(node);
|
|
79
|
-
const html = ReactServer.renderToStaticMarkup(React.createElement('body', null, deserialized));
|
|
80
|
-
const inner = html.slice(6, -7);
|
|
81
|
-
return inner;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
deserialize = (html) => {
|
|
85
|
-
let body = this.parseHtml(html);
|
|
86
|
-
|
|
87
|
-
if (body.firstChild && body.firstChild.nodeType === Node.TEXT_NODE) {
|
|
88
|
-
body = this.parseHtml(`<span>${html}</span>`);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return this.deserializeEls(body);
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
deserializeEls = (element, markAttributes = {}) => {
|
|
95
|
-
if (element.nodeType === Node.TEXT_NODE) {
|
|
96
|
-
return jsx('text', markAttributes, element.textContent);
|
|
97
|
-
} else if (element.nodeType !== Node.ELEMENT_NODE) {
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const nodeAttributes = { ...markAttributes };
|
|
102
|
-
|
|
103
|
-
// define attributes for text nodes
|
|
104
|
-
if (element.nodeName === 'STRONG') {
|
|
105
|
-
nodeAttributes.bold = true;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const nextFn = (nodes) => {
|
|
109
|
-
const childNodes = Array.from(nodes);
|
|
110
|
-
const children = Array.from(childNodes)
|
|
111
|
-
.map((node) => this.deserializeEls(node, nodeAttributes))
|
|
112
|
-
.flat();
|
|
113
|
-
|
|
114
|
-
if (children.length === 0) {
|
|
115
|
-
children.push(jsx('text', nodeAttributes, ''));
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return children;
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
const correctRule = this.rules.reduce((res, rule) => {
|
|
122
|
-
return res || rule.deserialize(element, nextFn);
|
|
123
|
-
}, null);
|
|
124
|
-
|
|
125
|
-
if (correctRule) {
|
|
126
|
-
return correctRule;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const childNodes = Array.from(element.childNodes);
|
|
130
|
-
const children = Array.from(childNodes)
|
|
131
|
-
.map((node) => this.deserializeEls(node, nodeAttributes))
|
|
132
|
-
.flat();
|
|
133
|
-
|
|
134
|
-
if (children.length === 0) {
|
|
135
|
-
children.push(jsx('text', nodeAttributes, ''));
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
switch (element.nodeName) {
|
|
139
|
-
case 'TABLE':
|
|
140
|
-
return jsx('element', { type: 'table' }, children);
|
|
141
|
-
case 'TBODY':
|
|
142
|
-
return jsx('element', { type: 'tbody' }, children);
|
|
143
|
-
case 'TR':
|
|
144
|
-
return jsx('element', { type: 'tr' }, children);
|
|
145
|
-
case 'TD':
|
|
146
|
-
return jsx('element', { type: 'td' }, children);
|
|
147
|
-
case 'BODY':
|
|
148
|
-
return jsx('fragment', {}, children);
|
|
149
|
-
case 'BR':
|
|
150
|
-
return '\n';
|
|
151
|
-
case 'BLOCKQUOTE':
|
|
152
|
-
return jsx('element', { type: 'quote' }, children);
|
|
153
|
-
case 'P':
|
|
154
|
-
return jsx('element', { type: 'paragraph' }, children);
|
|
155
|
-
case 'A':
|
|
156
|
-
return jsx('element', { type: 'link', url: element.getAttribute('href') }, children);
|
|
157
|
-
default:
|
|
158
|
-
return children;
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
export default Html;
|