email-builder-utils 1.1.42 → 1.1.44
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/convertJsonToHtml.d.ts.map +1 -1
- package/dist/utils/convertJsonToHtml.js +90 -83
- package/dist/utils/jsonToHTML.d.ts.map +1 -1
- package/dist/utils/jsonToHTML.js +556 -473
- package/dist/utils/outlookSupport.d.ts +210 -0
- package/dist/utils/outlookSupport.d.ts.map +1 -0
- package/dist/utils/outlookSupport.js +479 -0
- package/package.json +34 -33
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertJsonToHtml.d.ts","sourceRoot":"","sources":["../../src/utils/convertJsonToHtml.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,GAAU,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"convertJsonToHtml.d.ts","sourceRoot":"","sources":["../../src/utils/convertJsonToHtml.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,GAAU,UAAU,GAAG,oBAwHpD,CAAC"}
|
|
@@ -13,89 +13,96 @@ const convertJsonToHtml = async (jsonData) => {
|
|
|
13
13
|
}
|
|
14
14
|
const { fontFamily, canvasColor, textColor, padding = {}, borderColor, borderRadius, borderWidth, borderStyle, } = rootData.style || {};
|
|
15
15
|
const { top = 0, right = 0, bottom = 0, left = 0 } = padding;
|
|
16
|
-
const rawHtml = `<!DOCTYPE html>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
16
|
+
const rawHtml = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
17
|
+
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
|
|
18
|
+
<head>
|
|
19
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
20
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
21
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
22
|
+
<meta name="x-apple-disable-message-reformatting" />
|
|
23
|
+
<!--[if gte mso 9]><xml>
|
|
24
|
+
<o:OfficeDocumentSettings>
|
|
25
|
+
<o:AllowPNG/>
|
|
26
|
+
<o:PixelsPerInch>96</o:PixelsPerInch>
|
|
27
|
+
</o:OfficeDocumentSettings>
|
|
28
|
+
</xml><![endif]-->
|
|
29
|
+
<style>
|
|
30
|
+
.responsive-table {
|
|
31
|
+
width: 100%;
|
|
32
|
+
max-width: 600px;
|
|
33
|
+
}
|
|
34
|
+
@media only screen and (max-width: 600px) {
|
|
35
|
+
.responsive-table {
|
|
36
|
+
width: 100% !important;
|
|
37
|
+
}
|
|
38
|
+
.stack-column,
|
|
39
|
+
.stack-column td {
|
|
40
|
+
display: block !important;
|
|
41
|
+
width: 100% !important;
|
|
42
|
+
max-width: 100% !important;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
.hide-mobile {
|
|
46
|
+
display: block !important;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.hide-desktop {
|
|
50
|
+
display: block !important;
|
|
51
|
+
mso-hide: all !important; /* Hide in Outlook (treated as desktop) */
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@media only screen and (max-width: 600px) {
|
|
55
|
+
.hide-mobile {
|
|
56
|
+
display: none !important;
|
|
57
|
+
max-height: 0 !important;
|
|
58
|
+
overflow: hidden !important;
|
|
59
|
+
mso-hide: all !important;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@media only screen and (min-width: 601px) {
|
|
64
|
+
.hide-desktop {
|
|
65
|
+
display: none !important;
|
|
66
|
+
max-height: 0 !important;
|
|
67
|
+
overflow: hidden !important;
|
|
68
|
+
mso-hide: all !important;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
</style>
|
|
73
|
+
</head>
|
|
74
|
+
<body style="margin:0; padding:0; background-color:${canvasColor};">
|
|
75
|
+
<center style="width:100%; background-color:${canvasColor};">
|
|
76
|
+
<table
|
|
77
|
+
class="responsive-table"
|
|
78
|
+
role="presentation"
|
|
79
|
+
bgcolor="${canvasColor}"
|
|
80
|
+
cellpadding="0"
|
|
81
|
+
cellspacing="0"
|
|
82
|
+
border="0"
|
|
83
|
+
width="600"
|
|
84
|
+
align="center"
|
|
85
|
+
style="
|
|
86
|
+
font-family: ${(0, fontFallback_1.withFontFallback)(fontFamily)};
|
|
87
|
+
margin: 0 auto;
|
|
88
|
+
table-layout:fixed;
|
|
89
|
+
width:600px;
|
|
90
|
+
max-width:600px;
|
|
91
|
+
background-color: ${canvasColor};
|
|
92
|
+
${textColor ? `color: ${textColor};` : ''}
|
|
93
|
+
${borderWidth ? `border: ${borderWidth}px ${borderStyle || 'solid'} ${borderColor || 'transparent'};` : ''}
|
|
94
|
+
${borderRadius ? `border-radius: ${borderRadius}px;` : ''}"
|
|
95
|
+
>
|
|
96
|
+
<tbody>
|
|
97
|
+
<tr>
|
|
98
|
+
<td style="padding: ${top}px ${right}px ${bottom}px ${left}px;">
|
|
99
|
+
${blocksHtml.join("")}
|
|
100
|
+
</td>
|
|
101
|
+
</tr>
|
|
102
|
+
</tbody>
|
|
103
|
+
</table>
|
|
104
|
+
</center>
|
|
105
|
+
</body>
|
|
99
106
|
</html>`;
|
|
100
107
|
return rawHtml;
|
|
101
108
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonToHTML.d.ts","sourceRoot":"","sources":["../../src/utils/jsonToHTML.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAIrC,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;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MA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