diff options
| author | qsm-odoo <qsm@odoo.com> | 2018-02-13 12:04:51 +0100 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2018-02-13 13:37:50 +0100 |
| commit | 32bdadad1314360b1c5d4734435f481d2545bbf1 (patch) | |
| tree | 26e003f57204155a7e191e3843a215b32db6576a /addons/web_editor/static/src/js/transcoder.js | |
| parent | 1a7f3c7335a95901f0a6fd34af796485b99b8380 (diff) | |
[FIX] web_editor, mass_mailing: better transcode alignment inheritance
Browsers' default alignement of <td/> is 'inherit'. Some mail clients do
not set this value properly though and even if it is explicitely set,
they do not compute the final value well.
As a fix, this commit forces the 'inherit' value on <td/> and computes
the real alignment for 'inherit' values when transcoding.
opw-813688
Diffstat (limited to 'addons/web_editor/static/src/js/transcoder.js')
| -rw-r--r-- | addons/web_editor/static/src/js/transcoder.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/addons/web_editor/static/src/js/transcoder.js b/addons/web_editor/static/src/js/transcoder.js index 265ca5ab3f0..b402c14a39f 100644 --- a/addons/web_editor/static/src/js/transcoder.js +++ b/addons/web_editor/static/src/js/transcoder.js @@ -131,6 +131,20 @@ var getMatchedCSSRules = function (a) { delete style['text-decoration-style']; } + // text-align inheritance does not seem to get past <td> elements on some + // mail clients + if (style['text-align'] === 'inherit') { + var $el = $(a).parent(); + do { + var align = $el.css('text-align'); + if (_.indexOf(['left', 'right', 'center', 'justify'], align) >= 0) { + style['text-align'] = align; + break; + } + $el = $el.parent(); + } while (!$el.is('html')); + } + return style; }; |
