summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js/inline.js
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@odoo.com>2015-09-28 10:44:12 +0200
committerChristophe Matthieu <chm@odoo.com>2015-09-28 15:23:35 +0200
commitbdf58adb465b2016d0d288cdcdec592e4151061d (patch)
treed5e2924c409da80f9b6b783a9a6c181d718418ae /addons/web_editor/static/src/js/inline.js
parent6ebcc061523b60bb81aa837f93ce2f2a03f6d37f (diff)
[FIX] web_editor: send mail to outlook and keep 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).
Diffstat (limited to 'addons/web_editor/static/src/js/inline.js')
-rw-r--r--addons/web_editor/static/src/js/inline.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/addons/web_editor/static/src/js/inline.js b/addons/web_editor/static/src/js/inline.js
index c5fd2cfd924..a843d740a48 100644
--- a/addons/web_editor/static/src/js/inline.js
+++ b/addons/web_editor/static/src/js/inline.js
@@ -45,6 +45,9 @@ snippet_editor.Class.include({
var $editable = $("#editable_area");
transcoder.img_to_font($editable);
transcoder.style_to_class($editable);
+
+ // fix outlook image rendering bug
+ $editable.find('img[style*="width"], img[style*="height"]').removeAttr('height width');
});
},
clean_for_save: function () {
@@ -52,6 +55,15 @@ snippet_editor.Class.include({
var $editable = $("#editable_area");
transcoder.class_to_style($editable);
transcoder.font_to_img($editable);
+
+ // 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';
+ });
+ });
},
});
@@ -69,6 +81,9 @@ window.top.odoo[callback+"_updown"] = function (value, fields_values) {
transcoder.img_to_font($editable);
transcoder.style_to_class($editable);
+
+ // fix outlook image rendering bug
+ $editable.find('img[style*="width"], img[style*="height"]').removeAttr('height width');
} else {
$editable.trigger("content_changed");
}