[FIX] website_mail: outlook and image size

Office Outlook doesn't take into account the [style] attribute, and it
doesn't manage width/height in percent value.

This commit set width/heigth attribute in pixels and also always set the
width/height in style attribute (keeping them in the original unit and
setting them to auto if not present).

Thus if the mail application doesn't support the style attribute, the
pixels fixed size are used, else the original size is used.

closes #8566
opw-648463
This commit is contained in:
Nicolas Lempereur
2015-09-24 15:49:50 +02:00
parent 9047db401d
commit 3e70b26f25
@@ -303,6 +303,8 @@
setTimeout(function () {
self.img_to_font();
self.style_to_class();
// fix outlook image rendering bug
$("#wrapwrap .o_editable:first").find('img[style*="width"], img[style*="height"]').removeAttr('height width');
});
},
@@ -317,6 +319,14 @@
var theme = ($("#o_left_bar .o_panel_body > div:not(.hidden)").attr("class") || "").replace(/^\s*|\s*o_mail_block[^\s]+\s*|\s*oe_snippet\s*|\s*ui-draggable\s*|\s*$/g, '');
var $theme = $("#wrapwrap .o_editable:first [data-snippet-theme]").removeAttr("data-snippet-theme").removeData("snippet-theme");
$editable.children().first().attr("data-snippet-theme", theme);
// fix outlook image rendering bug
_.each(['width', 'height'], function(attribute) {
$editable.find('img[style*="width"], img[style*="height"]').attr(attribute, function(){
return $(this)[attribute]()
}).css(attribute, function(){
return $(this).get(0).style[attribute] || 'auto';
});
});
},
// convert font awsome into image
font_to_img: function () {