email-builder-utils 1.0.13 → 1.0.14

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.
@@ -4,7 +4,7 @@ exports.tableCommonStyle = void 0;
4
4
  exports.convertToHtml = convertToHtml;
5
5
  const jimp_1 = require("jimp");
6
6
  const types_1 = require("../types");
7
- const addPxToAttributes = ["fontSize", "lineHeight"];
7
+ const addPxToAttributes = ["fontSize", "lineHeight", "borderRadius"];
8
8
  const addPxOrPerToAttributes = ["width", "height"];
9
9
  const allPxAttributes = [...addPxToAttributes, ...addPxOrPerToAttributes];
10
10
  exports.tableCommonStyle = "border-collapse:collapse; table-layout:fixed;";
@@ -112,7 +112,7 @@ async function appendOutlookForImage(content, outerContainerWidth, innerContaine
112
112
  const scaledHeight = Math.round(originalHeight * widthScalingFactor); // Maintain aspect ratio
113
113
  // VML for Outlook
114
114
  const outlookImage = `<!--[if mso]>
115
- <v:rect xmlns:v="urn:schemas-microsoft-com:vml" style="width:${scaledWidth}px;height:${scaledHeight}px;">
115
+ <v:rect xmlns:v="urn:schemas-microsoft-com:vml" style="width:${scaledWidth}px;height:${scaledHeight}px;" stroke="f">
116
116
  <v:fill src="${imageUrl}" type="frame" />
117
117
  </v:rect>
118
118
  <![endif]-->`;
@@ -130,7 +130,7 @@ async function convertImageBlock(blockData, cellWidthInPx) {
130
130
  const imageStyle = { width, height, objectFit };
131
131
  const containerStyles = buildStyles(containerStyle, { perChanges: [], pxChanges: addPxToAttributes });
132
132
  const imageTagStyles = buildStyles(imageStyle, { perChanges: addPxOrPerToAttributes, pxChanges: addPxToAttributes });
133
- const imageElement = `<img src="${imageUrl}" alt="${altText}" style="${imageTagStyles}" />`;
133
+ const imageElement = `<img src="${imageUrl}" alt="${altText}" style="${imageTagStyles};display:block;" />`;
134
134
  const outlookImage = await appendOutlookForImage(imageElement, cellWidthInPx, ((typeof width === "string" ? parseInt(width.replace("%", "")) : width) / 100) * (cellWidthInPx - style?.padding?.left - style?.padding?.right), imageUrl);
135
135
  const imageContent = appendOutlookSupport(outlookImage, containerStyles);
136
136
  return navigateToUrl ? `<a href="${navigateToUrl}" target="_blank" style="display:block; text-decoration:none; cursor:pointer;">${imageContent}</a>` : imageContent;
@@ -141,7 +141,7 @@ function appendOutlookForButton(content, buttonStyle, navigateToUrl, text) {
141
141
  <!--[if mso]>
142
142
  <v:${borderRadius ? "roundrect" : "rect"} xmlns:v="urn:schemas-microsoft-com:vml" href="${navigateToUrl}" xmlns:w="urn:schemas-microsoft-com:office:word" style="height:${height || 44}px;width:${width || 200}px;v-text-anchor:middle;" arcsize="${borderRadius || 0}px" strokeweight="${borderWidth || 1}px" strokecolor="${borderColor || "transparent"}" fillcolor="${buttonColor || "none"}">
143
143
  <w:anchorlock/>
144
- <v:textbox inset="${buttonPadding?.top || 0}px, ${buttonPadding?.left || 0}px, ${buttonPadding?.bottom || 0}px, ${buttonPadding?.right || 0}px">
144
+ <v:textbox inset="${buttonPadding?.left || 0}px, ${buttonPadding?.top || 0}px, ${buttonPadding?.right || 0}px, ${buttonPadding?.bottom || 0}px">
145
145
  <center style="font-family:${fontFamily || ""};font-size:${fontSize}px;font-weight:${fontWeight};color:${color};">${text}</center>
146
146
  </v:textbox>
147
147
  </v:${borderRadius ? "roundrect" : "rect"}>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "email-builder-utils",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [