cf-pagetree-parser 1.0.0 → 1.0.2
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/README.md +8 -8
- package/dist/cf-pagetree-parser.js +36 -424
- package/package.json +2 -2
- package/src/index.js +13 -304
- package/src/parsers/button.js +18 -75
- package/src/parsers/layout.js +0 -24
- package/src/parsers/list.js +0 -1
- package/src/parsers/placeholders.js +0 -2
- package/src/parsers/text.js +4 -17
- package/src/utils.js +1 -1
package/src/parsers/text.js
CHANGED
|
@@ -37,8 +37,7 @@ function parseTextElement(
|
|
|
37
37
|
parentId,
|
|
38
38
|
index,
|
|
39
39
|
type,
|
|
40
|
-
selector
|
|
41
|
-
_styleGuideAttr
|
|
40
|
+
selector
|
|
42
41
|
) {
|
|
43
42
|
const id = generateId();
|
|
44
43
|
const contentEditableId = generateId();
|
|
@@ -127,14 +126,6 @@ function parseTextElement(
|
|
|
127
126
|
selectorStyle["font-family"] = fontFamily;
|
|
128
127
|
}
|
|
129
128
|
|
|
130
|
-
// Determine the style-guide-override param name based on type
|
|
131
|
-
const styleGuideOverrideMap = {
|
|
132
|
-
"Headline/V1": "style-guide-override-headline",
|
|
133
|
-
"SubHeadline/V1": "style-guide-override-subheadline",
|
|
134
|
-
"Paragraph/V1": "style-guide-override-content",
|
|
135
|
-
};
|
|
136
|
-
const styleGuideOverrideParam = styleGuideOverrideMap[type];
|
|
137
|
-
|
|
138
129
|
// Parse animation attributes
|
|
139
130
|
const { attrs: animationAttrs, params: animationParams } = parseAnimationAttrs(element);
|
|
140
131
|
|
|
@@ -161,7 +152,6 @@ function parseTextElement(
|
|
|
161
152
|
style: selectorStyle,
|
|
162
153
|
},
|
|
163
154
|
params: {
|
|
164
|
-
[styleGuideOverrideParam]: true,
|
|
165
155
|
"font-size--unit": fontSize ? fontSize.unit : "px",
|
|
166
156
|
"line-height--unit": "%",
|
|
167
157
|
"letter-spacing--unit": "rem",
|
|
@@ -244,8 +234,7 @@ export function parseHeadline(element, parentId, index) {
|
|
|
244
234
|
parentId,
|
|
245
235
|
index,
|
|
246
236
|
"Headline/V1",
|
|
247
|
-
".elHeadline"
|
|
248
|
-
"data-style-guide-headline"
|
|
237
|
+
".elHeadline"
|
|
249
238
|
);
|
|
250
239
|
}
|
|
251
240
|
|
|
@@ -258,8 +247,7 @@ export function parseSubHeadline(element, parentId, index) {
|
|
|
258
247
|
parentId,
|
|
259
248
|
index,
|
|
260
249
|
"SubHeadline/V1",
|
|
261
|
-
".elSubheadline"
|
|
262
|
-
"data-style-guide-subheadline"
|
|
250
|
+
".elSubheadline"
|
|
263
251
|
);
|
|
264
252
|
}
|
|
265
253
|
|
|
@@ -272,7 +260,6 @@ export function parseParagraph(element, parentId, index) {
|
|
|
272
260
|
parentId,
|
|
273
261
|
index,
|
|
274
262
|
"Paragraph/V1",
|
|
275
|
-
".elParagraph"
|
|
276
|
-
"data-style-guide-content"
|
|
263
|
+
".elParagraph"
|
|
277
264
|
);
|
|
278
265
|
}
|
package/src/utils.js
CHANGED
|
@@ -273,7 +273,7 @@ export function extractTextContent(element) {
|
|
|
273
273
|
/**
|
|
274
274
|
* Parse HTML content to ContentEditableNode children
|
|
275
275
|
* @param {string} html - The HTML content to parse
|
|
276
|
-
* @param {string|null} defaultLinkColor - Default color for links (from
|
|
276
|
+
* @param {string|null} defaultLinkColor - Default color for links (from data attribute)
|
|
277
277
|
*/
|
|
278
278
|
export function parseHtmlToTextNodes(html, defaultLinkColor = null) {
|
|
279
279
|
const temp = document.createElement('div');
|