mjmlhelper 2.1.7 → 2.1.9
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/README.md +1 -1
- package/mjmlhelper.js +7 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ mjmlhelper is a little toolbox for [mjml](https://mjml.io/) (v4.X) that...
|
|
|
4
4
|
|
|
5
5
|
- sends mails from the command line for testing and production,
|
|
6
6
|
- automatically inlines or uploads images for testing purposes,
|
|
7
|
-
- converts your template to the drag&drop editors of [CleverReach](https://www.cleverreach.com) and [Mailchimp](https://mailchimp.com).
|
|
7
|
+
- converts your template to the newest drag&drop editors of [CleverReach](https://www.cleverreach.com) and [Mailchimp](https://mailchimp.com).
|
|
8
8
|
|
|
9
9
|
it also includes a small boilerplate and some nifty updates for mjml.
|
|
10
10
|
|
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 =
|
|
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
|
-
|
|
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; } ' +
|