sr-npm 1.7.1252 → 1.7.1254

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.
@@ -137,7 +137,8 @@ async function htmlRichContentConverter(sections,richContentConverterToken) {
137
137
  );
138
138
  if (response.ok) {
139
139
  const data = await response.json();
140
- const richContentWithSpacing=addSpacingToRichContent(sectionData.text,data.richContent.richContent);
140
+ // const richContentWithSpacing=addSpacingToRichContent(sectionData.text,data.richContent.richContent);
141
+ const richContentWithSpacing=addEmptyParagraphsBetweenConsecutive(sectionData.text,data.richContent.richContent);
141
142
  richContentObject[sectionTitle] = richContentWithSpacing
142
143
  }
143
144
  else {
@@ -329,6 +330,35 @@ function createEmptyParagraph(id) {
329
330
  };
330
331
  }
331
332
 
333
+ // Adds empty paragraph after each paragraph node if HTML contains <p> tags
334
+ function addEmptyParagraphsBetweenConsecutive(html, richContent) {
335
+ if (!richContent || !richContent.nodes) return richContent;
336
+
337
+ const hasParagraphs = /<p[^>]*>.*?<\/p>/i.test(html);
338
+ if (!hasParagraphs) return richContent;
339
+
340
+ const nodes = richContent.nodes;
341
+ const newNodes = [];
342
+ let nodeIdCounter = 0;
343
+
344
+ for (let i = 0; i < nodes.length; i++) {
345
+ const currentNode = nodes[i];
346
+ const nextNode = nodes[i + 1];
347
+
348
+ newNodes.push(currentNode);
349
+
350
+ // Add empty paragraph after each paragraph if there's something after it
351
+ if (currentNode.type === 'PARAGRAPH' && nextNode) {
352
+ newNodes.push(createEmptyParagraph(`empty_${nodeIdCounter++}`));
353
+ }
354
+ }
355
+
356
+ return {
357
+ ...richContent,
358
+ nodes: newNodes
359
+ };
360
+ }
361
+
332
362
 
333
363
 
334
364
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.1252",
3
+ "version": "1.7.1254",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {