mjmlhelper 2.0.8 → 2.1.1

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.
Files changed (2) hide show
  1. package/mjmlhelper.js +9 -1
  2. package/package.json +1 -1
package/mjmlhelper.js CHANGED
@@ -82,6 +82,8 @@ class mjmlhelper {
82
82
  data.substring(pos);
83
83
  // hide modal overlay
84
84
  data = data.substring(0, pos) + ' body.cred_modal:before { display: none !important; } ' + data.substring(pos);
85
+ // fix font size 0 problem (https://github.com/vielhuber/mjmlhelper/issues/1)
86
+ data = data.substring(0, pos) + ' .mce-content-body { font-size: 13px; } ' + data.substring(pos);
85
87
 
86
88
  // placeholders
87
89
  data = this.replaceAll(data, '%UNSUBSCRIBE%', '{UNSUBSCRIBE}');
@@ -108,7 +110,7 @@ class mjmlhelper {
108
110
  positions = this.findAllPositions(' mj-outlook-group-fix', data).concat(
109
111
  this.findAllPositions('mj-hero-content', data).concat(
110
112
  []));
111
- positions.sort();
113
+ positions.sort((a, b) => { return a-b; });
112
114
  shift = 0;
113
115
  positions.forEach(positions__value => {
114
116
  let begin = data.indexOf('>', positions__value + shift) + '>'.length,
@@ -142,6 +144,12 @@ class mjmlhelper {
142
144
  style_tag = '<style type="text/css">',
143
145
  pos = data.indexOf(style_tag) + style_tag.length;
144
146
 
147
+ // mailchimp has problems with external fonts: when embedding google fonts, we get the error
148
+ // "An error occurred parsing your template CSS: Cannot find a CSS file at: https://fonts.googleapis.com/css?family=Tinos:400"
149
+ // see: https://github.com/sendwithus/templates/issues/21
150
+ // we strip out all occurences of @import (<link href="https://fonts.googleapis.com/..."> is still left behind)
151
+ data = data.replace(/@import url\(https:\/\/fonts.googleapis.com.*\);/g, '');
152
+
145
153
  // when replacing images in mailchimp, style="width:" is set to a fixed size. we prevent this with
146
154
  data = data.substring(0, pos) + ' img { max-width:100%; height:auto !important; } ' + data.substring(pos);
147
155
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mjmlhelper",
3
- "version": "2.0.8",
3
+ "version": "2.1.1",
4
4
  "description": "",
5
5
  "main": "mjmlhelper.js",
6
6
  "dependencies": {