sr-npm 1.7.1262 → 1.7.1264

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.
@@ -139,8 +139,10 @@ async function htmlRichContentConverter(sections,richContentConverterToken,jobNa
139
139
  );
140
140
  if (response.ok) {
141
141
  const data = await response.json();
142
- // const richContentWithSpacing=addSpacingToRichContent(cleanedHtml,data.richContent.richContent);
143
- const richContentWithSpacing=addEmptyParagraphsBetweenConsecutive(cleanedHtml,data.richContent.richContent,jobName);
142
+ // Fix list items with nested paragraphs (causes line breaks after bold text)
143
+ const flattenedContent = flattenListItems(data.richContent.richContent);
144
+ // const richContentWithSpacing=addSpacingToRichContent(cleanedHtml,flattenedContent);
145
+ const richContentWithSpacing=addEmptyParagraphsBetweenConsecutive(cleanedHtml,flattenedContent,jobName);
144
146
  richContentObject[sectionTitle] = richContentWithSpacing
145
147
  }
146
148
  else {
@@ -332,17 +334,51 @@ function createEmptyParagraph(id) {
332
334
  };
333
335
  }
334
336
 
337
+ // Flattens LIST_ITEM nodes by removing nested PARAGRAPH wrappers
338
+ // Fixes Wix converter bug where bold text + regular text in <li> creates line breaks
339
+ function flattenListItems(richContent) {
340
+ if (!richContent || !richContent.nodes) return richContent;
341
+
342
+ const processNode = (node) => {
343
+ if (node.type === 'BULLETED_LIST' || node.type === 'ORDERED_LIST') {
344
+ return {
345
+ ...node,
346
+ nodes: node.nodes.map(listItem => {
347
+ if (listItem.type !== 'LIST_ITEM') return listItem;
348
+
349
+ // Flatten: extract TEXT nodes from nested PARAGRAPHs
350
+ const flattenedChildren = [];
351
+ for (const child of listItem.nodes) {
352
+ if (child.type === 'PARAGRAPH' && child.nodes) {
353
+ // Pull TEXT nodes out of the PARAGRAPH
354
+ flattenedChildren.push(...child.nodes);
355
+ } else {
356
+ flattenedChildren.push(child);
357
+ }
358
+ }
359
+
360
+ return { ...listItem, nodes: flattenedChildren };
361
+ })
362
+ };
363
+ }
364
+ return node;
365
+ };
366
+
367
+ return {
368
+ ...richContent,
369
+ nodes: richContent.nodes.map(processNode)
370
+ };
371
+ }
372
+
335
373
  // Adds empty paragraph nodes between consecutive paragraphs and before lists
336
374
  function addEmptyParagraphsBetweenConsecutive(html, richContent,jobName) {
337
375
  console.log("jobName is : ",jobName);
338
- if(jobName.name===" Apparel Team Member - The Warehouse, Dargaville")
376
+ if(jobName.name==="Assistant Store Manager - Noel Leeming Albany")
339
377
  {
340
378
  console.log("rich content is : ",richContent);
341
379
  console.log("html is : ",html);
342
380
  }
343
381
  if (!richContent || !richContent.nodes) return richContent;
344
- html = html.replace(/<\/?span[^>]*>/gi, '');
345
- console.log("html is after : ",html);
346
382
  const hasConsecutiveParagraphs = /<\/p>\s*<p/i.test(html);
347
383
  const hasParagraphBeforeList = /<\/p>\s*<ul/i.test(html);
348
384
  const hasParagraphAfterList = /<\/ul>\s*<p/i.test(html);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.1262",
3
+ "version": "1.7.1264",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {