mjmlhelper 2.1.1 → 2.1.2
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/mjmlhelper.js +20 -1
- package/package.json +1 -1
package/mjmlhelper.js
CHANGED
|
@@ -84,7 +84,26 @@ class mjmlhelper {
|
|
|
84
84
|
data = data.substring(0, pos) + ' body.cred_modal:before { display: none !important; } ' + data.substring(pos);
|
|
85
85
|
// fix font size 0 problem (https://github.com/vielhuber/mjmlhelper/issues/1)
|
|
86
86
|
data = data.substring(0, pos) + ' .mce-content-body { font-size: 13px; } ' + data.substring(pos);
|
|
87
|
-
|
|
87
|
+
// fix problem where img sizes get overwritten
|
|
88
|
+
data = data.substring(0, pos) + ' .preserve-cr-full-size { width:100% !important; height:auto !important; } ' + data.substring(pos);
|
|
89
|
+
positions = this.findAllPositions('<img', data);
|
|
90
|
+
shift = 0;
|
|
91
|
+
positions.forEach(positions__value => {
|
|
92
|
+
let begin = positions__value + shift,
|
|
93
|
+
end = data.indexOf('>', begin) + '>'.length,
|
|
94
|
+
tag = data.substring(begin, end);
|
|
95
|
+
if( tag.indexOf('width:100%') > -1 ) {
|
|
96
|
+
if( tag.indexOf('class="') > -1 ) {
|
|
97
|
+
data = data.substring(0, begin) + tag.replace('class="', 'class="preserve-cr-full-size ') + data.substring(end);
|
|
98
|
+
shift += 'class="preserve-cr-full-size '.length - 'class="'.length;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
data = data.substring(0, begin) + tag.replace('<img ', '<img class="preserve-cr-full-size" ') + data.substring(end);
|
|
102
|
+
shift += '<img class="preserve-cr-full-size" '.length - '<img '.length;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
88
107
|
// placeholders
|
|
89
108
|
data = this.replaceAll(data, '%UNSUBSCRIBE%', '{UNSUBSCRIBE}');
|
|
90
109
|
data = this.replaceAll(data, '%WEBVERSION%', '{ONLINE_VERSION}');
|