From fce729e65aff165799ad10571985da260ded2559 Mon Sep 17 00:00:00 2001 From: "Julien (juc) Castiaux" Date: Mon, 3 Dec 2018 09:38:47 +0000 Subject: [FIX] web_editor: banner not horizontaly centered When creating a banner using the web editor, the targeted image appears centered in the editor but is aligned on the left in the email. The issue also happened with other alignment (left in a centered widget, right, ...) for example on outlook 2007 and should be solved with this changeset. opw-1904827 Co-authored-by: Nicolas Lempereur closes #29985 closes odoo/odoo#29214 --- addons/web_editor/static/src/js/editor/transcoder.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'addons/web_editor/static/src/js/editor/transcoder.js') diff --git a/addons/web_editor/static/src/js/editor/transcoder.js b/addons/web_editor/static/src/js/editor/transcoder.js index 488cf5a8177..a4b62554bde 100644 --- a/addons/web_editor/static/src/js/editor/transcoder.js +++ b/addons/web_editor/static/src/js/editor/transcoder.js @@ -252,6 +252,9 @@ function applyOverDescendants(node, func) { if (node.nodeName === 'A' && $node.hasClass('btn') && !$node.children().length && $(node).parents('.o_outlook_hack').length) { node = $(node).parents('.o_outlook_hack')[0]; } + else if (node.nodeName === 'IMG' && $node.parent('p').hasClass('o_outlook_hack')) { + node = $node.parent()[0]; + } node = node.nextSibling; } } @@ -308,6 +311,9 @@ function classToStyle($editable) { $(node).remove(); } } + else if (node.nodeName === 'IMG' && $target.hasClass('center-block')) { + $target.wrap('

'); + } }); } @@ -319,8 +325,8 @@ function classToStyle($editable) { */ function styleToClass($editable) { // Outlook revert - $editable.find('table.o_outlook_hack').each(function () { - $(this).after($('a', this)); + $editable.find('.o_outlook_hack').each(function () { + $(this).after($('a,img', this)); }).remove(); getMatchedCSSRules($editable[0]); -- cgit v1.2.3