mjmlhelper 2.1.6 → 2.1.8

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.
@@ -1,5 +1,6 @@
1
1
  *
2
2
  !.gitignore
3
+ !.nvmrc
3
4
  !index.mjml
4
5
  !package.json
5
6
  !/_assets/
package/mjmlhelper.js CHANGED
@@ -166,25 +166,30 @@ class mjmlhelper {
166
166
  let positions,
167
167
  shift,
168
168
  style_tag = '<style type="text/css">',
169
- pos = data.indexOf(style_tag) + style_tag.length;
169
+ pos = null;
170
170
 
171
171
  // mailchimp has problems with external fonts: when embedding google fonts, we get the error
172
172
  // "An error occurred parsing your template CSS: Cannot find a CSS file at: https://fonts.googleapis.com/css?family=Tinos:400"
173
173
  // see: https://github.com/sendwithus/templates/issues/21
174
174
  // we strip out all occurences of @import (<link href="https://fonts.googleapis.com/..."> is still left behind)
175
- data = data.replace(/@import url\(https:\/\/fonts.googleapis.com.*\);/g, '');
175
+ pos = data.indexOf(style_tag) + style_tag.length;
176
+ data = data.replace(/@import url\(https:\/\/fonts\.googleapis\.com.*?\);/g, '');
176
177
 
177
178
  // when replacing images in mailchimp, style="width:" is set to a fixed size. we prevent this with
179
+ pos = data.indexOf(style_tag) + style_tag.length;
178
180
  data = data.substring(0, pos) + ' img { max-width:100%; height:auto !important; } ' + data.substring(pos);
179
181
 
182
+
180
183
  // increase ordering icon
181
184
  // also there is a bug in mailchimp: when adding a new module and changing it's type, the ID is lost and the element cannot be moved; we fix this also here (we simply hide the move icon when the ID is missing)
185
+ pos = data.indexOf(style_tag) + style_tag.length;
182
186
  data =
183
187
  data.substring(0, pos) +
184
188
  ' .tpl-repeatmovewrap>.tpl-repeatmove { background-color: #fff !important; top: -10px !important; left: -20px !important; width: 100px !important; height: 50px !important; border:2px solid grey !important; background-position:center !important; display:none !important; } div[mcrepeatable][id] .tpl-repeatmovewrap>.tpl-repeatmove { display: block !important; } ' +
185
189
  data.substring(pos);
186
190
 
187
191
  // remove hide icon
192
+ pos = data.indexOf(style_tag) + style_tag.length;
188
193
  data =
189
194
  data.substring(0, pos) +
190
195
  ' .tpl-repeatwrap.can-hide .tpl-hidetoggle { display:none !important; } ' +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mjmlhelper",
3
- "version": "2.1.6",
3
+ "version": "2.1.8",
4
4
  "description": "",
5
5
  "main": "mjmlhelper.js",
6
6
  "dependencies": {