sr-npm 1.7.1216 → 1.7.1218
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,7 +139,7 @@ async function htmlRichContentConverter(sections,richContentConverterToken) {
|
|
|
139
139
|
const richContentWithSpacing=addSpacingToRichContent(sectionData.text,data.richContent.richContent);
|
|
140
140
|
console.log("richContentWithSpacing ====");
|
|
141
141
|
console.log(richContentWithSpacing);
|
|
142
|
-
|
|
142
|
+
|
|
143
143
|
console.log("data.richContent.richContent ====");
|
|
144
144
|
console.log(data.richContent.richContent);
|
|
145
145
|
richContentObject[sectionTitle] = richContentWithSpacing
|
|
@@ -155,6 +155,9 @@ async function htmlRichContentConverter(sections,richContentConverterToken) {
|
|
|
155
155
|
//Adds empty paragraph nodes between sections in rich content
|
|
156
156
|
// to create visual spacing that the Wix RICOS converter strips out
|
|
157
157
|
function addSpacingToRichContent(html, richContent) {
|
|
158
|
+
if (!richContent || !richContent.nodes) {
|
|
159
|
+
return richContent;
|
|
160
|
+
}
|
|
158
161
|
|
|
159
162
|
// Extract paragraph texts from HTML that end with  
|
|
160
163
|
const htmlParagraphsWithSpace = [];
|
|
@@ -192,10 +195,22 @@ function addSpacingToRichContent(html, richContent) {
|
|
|
192
195
|
const newNodes = [];
|
|
193
196
|
let nodeIdCounter = 0;
|
|
194
197
|
|
|
198
|
+
// Check if a paragraph is bold (has BOLD decoration)
|
|
199
|
+
const isBoldParagraph = (node) => {
|
|
200
|
+
if (node.type !== 'PARAGRAPH') return false;
|
|
201
|
+
const decorations = node.nodes?.[0]?.textData?.decorations || [];
|
|
202
|
+
return decorations.some(d => d.type === 'BOLD');
|
|
203
|
+
};
|
|
204
|
+
|
|
195
205
|
// Check if a paragraph node's text matches one with   in HTML
|
|
196
206
|
const needsSpacingAfter = (node) => {
|
|
197
207
|
if (node.type !== 'PARAGRAPH') return false;
|
|
198
208
|
|
|
209
|
+
// Add spacing after bold paragraphs
|
|
210
|
+
if (isBoldParagraph(node)) {
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
213
|
+
|
|
199
214
|
const text = node.nodes?.[0]?.textData?.text || '';
|
|
200
215
|
const trimmedText = text.trim();
|
|
201
216
|
|