diff options
| author | Nicolas Lempereur <nle@odoo.com> | 2021-01-27 15:36:06 +0000 |
|---|---|---|
| committer | Nicolas Lempereur <nle@odoo.com> | 2021-01-28 12:32:31 +0000 |
| commit | 01e09720ed0829d31bf0929d5a418c7b267ad712 (patch) | |
| tree | a5c7a0c5d00a86f007b1c53bf6e4880caf6234e9 /addons/web_editor/static/src/js | |
| parent | 8b7ca94c70e374f7c0d5850a7976bc2cbf0b0b40 (diff) | |
[FIX] mass_mailing, 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).
This is a reintroduction of 2015 commit bdf58adb465b
opw-2447756
closes odoo/odoo#65212
X-original-commit: c51762a790d6fefd97e6c818bfaa9307180dd5b5
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Diffstat (limited to 'addons/web_editor/static/src/js')
| -rw-r--r-- | addons/web_editor/static/src/js/backend/convert_inline.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/addons/web_editor/static/src/js/backend/convert_inline.js b/addons/web_editor/static/src/js/backend/convert_inline.js index 8f8daab67c7..13c7c68128b 100644 --- a/addons/web_editor/static/src/js/backend/convert_inline.js +++ b/addons/web_editor/static/src/js/backend/convert_inline.js @@ -422,6 +422,16 @@ FieldHtml.include({ attachmentThumbnailToLinkImg($editable); fontToImg($editable); classToStyle($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'; + }); + }); + this.wysiwyg.setValue($editable.html(), { notifyChange: false, }); @@ -439,6 +449,10 @@ FieldHtml.include({ styleToClass($editable); imgToFont($editable); linkImgToAttachmentThumbnail($editable); + + // fix outlook image rendering bug + $editable.find('img[style*="width"], img[style*="height"]').removeAttr('height width'); + this.wysiwyg.setValue($editable.html(), { notifyChange: false, }); |
