[FIX] web_editor: fix mso conditionals

This addresses a series of issues with mso conditionals that were not
closing in the right places.

X-original-commit: 247e05a9cca403fca3de01feb49d0f0374ea38de
Part-of: odoo/odoo#124465
This commit is contained in:
Antoine Guenet
2023-06-09 17:01:37 +02:00
parent 64a0f84640
commit c195682ca9
@@ -425,7 +425,7 @@ function classToStyle($editable, cssRules) {
<table align="center" role="presentation" border="0" cellpadding="0" cellspacing="0" style="border-radius: 6px; border-collapse: separate !important;">
<tbody>
<tr>
<td style="${node.style.cssText.replace(RE_PADDING_MATCH, '')}" ${
<td style="${node.style.cssText.replace(RE_PADDING_MATCH, '').replaceAll('"', '&quot;')}" ${
node.parentElement.style.textAlign === 'center' ? 'align="center" ' : ''
}bgcolor="${rgbToHex(node.style.backgroundColor)}">
<![endif]`));
@@ -1038,10 +1038,11 @@ function normalizeRem($editable, rootFontSize=16) {
} else {
outlookTd.setAttribute('style', msoStyles);
}
// The opening tag of `outlookTd` is for Outlook.
td.before(document.createComment(`[if mso]>${outlookTd.outerHTML.replace('</td>', '')}<![endif]`));
td.before(document.createComment('[if !mso]><!--'));
// The opening tag of `td` is for the others.
td.before(document.createComment('[if !mso]><!'));
td.prepend(document.createComment('<![endif]'));
td.after(document.createComment(`[if mso]></td><![endif]`));
}
}
/**