email-builder-utils 1.0.14 → 1.0.15
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.
- package/dist/utils/jsonToHTML.js +4 -4
- package/package.json +1 -1
package/dist/utils/jsonToHTML.js
CHANGED
|
@@ -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;" stroke="f">
|
|
115
|
+
<v:rect xmlns:v="urn:schemas-microsoft-com:vml" style="width:${scaledWidth}px;height:${scaledHeight}px;" stroke="f" fillcolor="none">
|
|
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}" />`;
|
|
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;
|
|
@@ -139,9 +139,9 @@ function appendOutlookForButton(content, buttonStyle, navigateToUrl, text) {
|
|
|
139
139
|
const { width, buttonColor, borderColor, borderRadius, borderWidth, height, buttonPadding, color, fontFamily, fontSize, fontWeight } = buttonStyle;
|
|
140
140
|
return `
|
|
141
141
|
<!--[if mso]>
|
|
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}
|
|
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}%" strokeweight="${borderWidth || 1}px" strokecolor="${borderColor || "none"}" fillcolor="${buttonColor || "none"}">
|
|
143
143
|
<w:anchorlock/>
|
|
144
|
-
<v:textbox inset="
|
|
144
|
+
<v:textbox inset="0px, 0px, 0px, 0px">
|
|
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"}>
|