@postalsys/email-text-tools 2.1.15 → 2.1.16
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/CHANGELOG.md +7 -0
- package/lib/mime-html.js +4 -10
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.1.16](https://github.com/postalsys/email-text-tools/compare/v2.1.15...v2.1.16) (2025-06-29)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* removed unneeded console log lines ([3a10214](https://github.com/postalsys/email-text-tools/commit/3a1021483029a1c99df122241c4e0f6062b91059))
|
|
9
|
+
|
|
3
10
|
## [2.1.15](https://github.com/postalsys/email-text-tools/compare/v2.1.14...v2.1.15) (2025-05-20)
|
|
4
11
|
|
|
5
12
|
|
package/lib/mime-html.js
CHANGED
|
@@ -106,7 +106,7 @@ function mimeHtml(message) {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
html = html.toString().replace(/^"data:[^"]+"/g, '');
|
|
109
|
-
|
|
109
|
+
|
|
110
110
|
try {
|
|
111
111
|
//inline styles
|
|
112
112
|
//html = juice(html);
|
|
@@ -114,23 +114,20 @@ function mimeHtml(message) {
|
|
|
114
114
|
// should log?
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
console.log(1, Date.now());
|
|
118
117
|
const window = new JSDOM('').window;
|
|
119
|
-
|
|
118
|
+
|
|
120
119
|
const DOMPurify = createDOMPurify(window);
|
|
121
|
-
|
|
120
|
+
|
|
122
121
|
// first pass, outputs a fixed HTML page
|
|
123
122
|
html = DOMPurify.sanitize(html, { WHOLE_DOCUMENT: true, FORCE_BODY: false, FORBID_TAGS });
|
|
124
|
-
|
|
123
|
+
|
|
125
124
|
try {
|
|
126
125
|
//inline styles
|
|
127
126
|
html = juice(html);
|
|
128
127
|
} catch (err) {
|
|
129
|
-
console.log(err);
|
|
130
128
|
// not so important, so we'll ignore if style inlining fails
|
|
131
129
|
// should log?
|
|
132
130
|
}
|
|
133
|
-
console.log(5, Date.now());
|
|
134
131
|
|
|
135
132
|
// second pass, outputs a BODY DOM element
|
|
136
133
|
const dom = DOMPurify.sanitize(html, {
|
|
@@ -139,7 +136,6 @@ function mimeHtml(message) {
|
|
|
139
136
|
FORCE_BODY: true,
|
|
140
137
|
FORBID_TAGS: FORBID_TAGS_ALL
|
|
141
138
|
});
|
|
142
|
-
console.log(6, Date.now());
|
|
143
139
|
|
|
144
140
|
// mark all links to be opened in a new window
|
|
145
141
|
for (let elm of dom.querySelectorAll('a')) {
|
|
@@ -157,7 +153,6 @@ function mimeHtml(message) {
|
|
|
157
153
|
dom.style.removeProperty('min-height');
|
|
158
154
|
dom.style.removeProperty('max-height');
|
|
159
155
|
|
|
160
|
-
console.log(7, Date.now());
|
|
161
156
|
// remove specific style properties for all DOM nodes
|
|
162
157
|
let walkDom = node => {
|
|
163
158
|
if (node.style) {
|
|
@@ -174,7 +169,6 @@ function mimeHtml(message) {
|
|
|
174
169
|
};
|
|
175
170
|
walkDom(dom);
|
|
176
171
|
|
|
177
|
-
console.log(8, Date.now());
|
|
178
172
|
let bodyStyles = (dom.getAttribute('style') || '').toString().trim();
|
|
179
173
|
|
|
180
174
|
// embed into a styled container
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@postalsys/email-text-tools",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.16",
|
|
4
4
|
"description": "Email text tools",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"jsdom": "26.1.0",
|
|
30
30
|
"juice": "11.0.1",
|
|
31
31
|
"linkify-it": "5.0.0",
|
|
32
|
-
"moment-timezone": "0.
|
|
32
|
+
"moment-timezone": "0.6.0",
|
|
33
33
|
"node-html-parser": "7.0.1",
|
|
34
34
|
"tlds": "1.259.0"
|
|
35
35
|
}
|