cf-pagetree-parser 1.0.0 → 1.0.3

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.
@@ -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
@@ -8,26 +8,12 @@
8
8
  * ============================================================================
9
9
  */
10
10
 
11
- // Use DOMPurify in browser, simple passthrough on server
12
- // Server-side parsing is from trusted FunnelWind source
13
- let DOMPurify = null;
14
- if (typeof window !== 'undefined') {
15
- import('dompurify').then(mod => { DOMPurify = mod.default; });
16
- }
17
-
18
11
  /**
19
- * Sanitize HTML to prevent XSS attacks
20
- * Allows only safe formatting tags for text content
12
+ * Sanitize HTML - passthrough for trusted FunnelWind source content
21
13
  */
22
14
  export function sanitizeHtml(html) {
23
15
  if (!html) return '';
24
- // On server or before DOMPurify loads, return HTML as-is
25
- // (server-side parsing is from trusted FunnelWind source)
26
- if (!DOMPurify) return html;
27
- return DOMPurify.sanitize(html, {
28
- ALLOWED_TAGS: ['b', 'strong', 'i', 'em', 'u', 's', 'strike', 'a', 'br', 'span', 'li'],
29
- ALLOWED_ATTR: ['href', 'target', 'rel', 'style', 'class'],
30
- });
16
+ return html;
31
17
  }
32
18
 
33
19
  /**
@@ -273,7 +259,7 @@ export function extractTextContent(element) {
273
259
  /**
274
260
  * Parse HTML content to ContentEditableNode children
275
261
  * @param {string} html - The HTML content to parse
276
- * @param {string|null} defaultLinkColor - Default color for links (from styleguide or data attribute)
262
+ * @param {string|null} defaultLinkColor - Default color for links (from data attribute)
277
263
  */
278
264
  export function parseHtmlToTextNodes(html, defaultLinkColor = null) {
279
265
  const temp = document.createElement('div');