sr-npm 1.7.1253 → 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.
|
@@ -330,14 +330,12 @@ function createEmptyParagraph(id) {
|
|
|
330
330
|
};
|
|
331
331
|
}
|
|
332
332
|
|
|
333
|
-
// Adds empty paragraph
|
|
333
|
+
// Adds empty paragraph after each paragraph node if HTML contains <p> tags
|
|
334
334
|
function addEmptyParagraphsBetweenConsecutive(html, richContent) {
|
|
335
335
|
if (!richContent || !richContent.nodes) return richContent;
|
|
336
336
|
|
|
337
|
-
const
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
if (!hasConsecutiveParagraphs && !hasParagraphBeforeList) return richContent;
|
|
337
|
+
const hasParagraphs = /<p[^>]*>.*?<\/p>/i.test(html);
|
|
338
|
+
if (!hasParagraphs) return richContent;
|
|
341
339
|
|
|
342
340
|
const nodes = richContent.nodes;
|
|
343
341
|
const newNodes = [];
|
|
@@ -349,15 +347,9 @@ function addEmptyParagraphsBetweenConsecutive(html, richContent) {
|
|
|
349
347
|
|
|
350
348
|
newNodes.push(currentNode);
|
|
351
349
|
|
|
350
|
+
// Add empty paragraph after each paragraph if there's something after it
|
|
352
351
|
if (currentNode.type === 'PARAGRAPH' && nextNode) {
|
|
353
|
-
|
|
354
|
-
if (hasConsecutiveParagraphs && nextNode.type === 'PARAGRAPH') {
|
|
355
|
-
newNodes.push(createEmptyParagraph(`empty_consecutive_${nodeIdCounter++}`));
|
|
356
|
-
}
|
|
357
|
-
// Add empty paragraph before list
|
|
358
|
-
if (hasParagraphBeforeList && nextNode.type === 'BULLETED_LIST') {
|
|
359
|
-
newNodes.push(createEmptyParagraph(`empty_before_list_${nodeIdCounter++}`));
|
|
360
|
-
}
|
|
352
|
+
newNodes.push(createEmptyParagraph(`empty_${nodeIdCounter++}`));
|
|
361
353
|
}
|
|
362
354
|
}
|
|
363
355
|
|