email-builder-utils 1.1.15 → 1.1.19
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertJsonToHtml.d.ts","sourceRoot":"","sources":["../../src/utils/convertJsonToHtml.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,GAAU,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"convertJsonToHtml.d.ts","sourceRoot":"","sources":["../../src/utils/convertJsonToHtml.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,GAAU,UAAU,GAAG,oBAgFpD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonToHTML.d.ts","sourceRoot":"","sources":["../../src/utils/jsonToHTML.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AASrC,UAAU,cAAc;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"jsonToHTML.d.ts","sourceRoot":"","sources":["../../src/utils/jsonToHTML.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AASrC,UAAU,cAAc;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,UAAU,UAAU;IAClB,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE;QACJ,KAAK,EAAE,cAAc,CAAC;QACtB,KAAK,EAAE,GAAG,CAAC;QACX,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;KAC7B,CAAC;CACH;AAYD,eAAO,MAAM,gBAAgB,kDAAkD,CAAC;AA2DhF,wBAAsB,aAAa,CACjC,SAAS,EAAE,UAAU,EACrB,QAAQ,EAAE,GAAG,EACb,aAAa,EAAE,MAAM,mBAkBtB"}
|
package/dist/utils/jsonToHTML.js
CHANGED
|
@@ -247,7 +247,7 @@ function convertButtonBlock(blockData) {
|
|
|
247
247
|
}
|
|
248
248
|
async function convertGridBlock(blockData, rootData, cellWidthInPx) {
|
|
249
249
|
const { style = {}, childrenIds = [], props } = blockData.data;
|
|
250
|
-
const { columns = 1, cellWidths = [] } = props;
|
|
250
|
+
const { columns = 1, cellWidths = [], responsive = true } = props;
|
|
251
251
|
const { columnGap = 0, ...restStyle } = style;
|
|
252
252
|
const tableStyles = buildStyles(restStyle, {
|
|
253
253
|
perChanges: [],
|
|
@@ -271,20 +271,18 @@ async function convertGridBlock(blockData, rootData, cellWidthInPx) {
|
|
|
271
271
|
const child = rootData[childId];
|
|
272
272
|
const { style: cellStyle = {} } = child.data || {};
|
|
273
273
|
const verticalAlign = cellStyle.verticalAlign || "top";
|
|
274
|
-
const childHtml = child
|
|
275
|
-
? await convertGridCellBlock(child, rootData, widthPercent, cellWidthInPx)
|
|
276
|
-
: "";
|
|
274
|
+
const { html: childHtml, styles } = await convertGridCellBlock(child, rootData, widthPercent, cellWidthInPx);
|
|
277
275
|
html += `
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
276
|
+
<td
|
|
277
|
+
width="${widthPercent}%"
|
|
278
|
+
${responsive ? 'class="stack-column"' : ""}
|
|
279
|
+
style="vertical-align:${verticalAlign}; padding:0; word-break:break-word; ${styles}"
|
|
280
|
+
>
|
|
281
|
+
${childHtml}
|
|
282
|
+
</td>`;
|
|
285
283
|
}
|
|
286
284
|
else {
|
|
287
|
-
html += `<td width="${widthPercent}%" class="stack-column" style="padding:0;"></td>`;
|
|
285
|
+
html += `<td width="${widthPercent}%" ${responsive ? 'class="stack-column"' : ""} style="padding:0;"></td>`;
|
|
288
286
|
}
|
|
289
287
|
}
|
|
290
288
|
html += "</tr>";
|
|
@@ -306,20 +304,8 @@ async function convertGridCellBlock(blockData, rootData, cellWidthPercent, paren
|
|
|
306
304
|
innerHtmlParts.push(await convertToHtml(child, rootData, cellWidthPx));
|
|
307
305
|
}
|
|
308
306
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
border="0"
|
|
314
|
-
cellpadding="0"
|
|
315
|
-
cellspacing="0"
|
|
316
|
-
width="100%"
|
|
317
|
-
style="border-collapse:collapse;table-layout:fixed;${styles}"
|
|
318
|
-
>
|
|
319
|
-
<tr>
|
|
320
|
-
<td style="padding:0;">
|
|
321
|
-
${innerContent}
|
|
322
|
-
</td>
|
|
323
|
-
</tr>
|
|
324
|
-
</table>`;
|
|
307
|
+
return {
|
|
308
|
+
html: innerHtmlParts.join(""),
|
|
309
|
+
styles,
|
|
310
|
+
};
|
|
325
311
|
}
|