[FIX] web_editor: fix .img-fluid for Outlook

Outlook needs explicit dimensions for images, which .img-fluid - by
design - doesn't provide. This puts them in mso conditionals with said
dimensions for Outlook.

X-original-commit: d0949de8ce895b7da5fd128fb5d72d23d5634866
Part-of: odoo/odoo#124465
This commit is contained in:
Antoine Guenet
2023-06-09 17:01:44 +02:00
parent ee8442d3c0
commit 22246567be
@@ -696,6 +696,16 @@ async function toInline($editable, cssRules, $iframe) {
for (const imgTop of editable.querySelectorAll('.card-img-top')) {
imgTop.style.setProperty('height', _getHeight(imgTop) + 'px');
}
// Fix img-fluid for Outlook.
for (const image of editable.querySelectorAll('img.img-fluid')) {
const width = _getWidth(image);
const clone = image.cloneNode();
clone.setAttribute('width', width);
clone.style.setProperty('width', width + 'px');
clone.style.removeProperty('max-width');
image.before(_createMso(clone.outerHTML));
_hideForOutlook(image);
}
attachmentThumbnailToLinkImg($editable);
fontToImg($editable);