[FIX] web_editor: prevent double quotes in font-family style
The `font-family` style can sometimes include double quotes. This isn't really a problem since these get escaped (`"`) but emailonacid currently has a bug where the double quotes cause every subsequent style to be ignored, and the rendering to be incorrect. For the sake of future testing, this converts them to single quotes. It also removes the style entirely from image elements since they don't make sense there. X-original-commit: 03c7e69db63f326c7a3b3085debc5d3a5c95966d Part-of: odoo/odoo#129153
This commit is contained in:
@@ -756,6 +756,14 @@ async function toInline($editable, cssRules, $iframe) {
|
||||
// Hide replaced cells on Outlook
|
||||
editable.querySelectorAll('.mso-hide').forEach(_hideForOutlook);
|
||||
|
||||
// Replace double quotes in font-family styles with simple quotes (and
|
||||
// simply remove these styles from images).
|
||||
editable.querySelectorAll('[style*=font-family]').forEach(n => (
|
||||
n.nodeName === 'IMG'
|
||||
? n.style.removeProperty('font-family')
|
||||
: n.setAttribute('style', n.getAttribute('style').replaceAll('"', '\''))
|
||||
));
|
||||
|
||||
// Styles were applied inline, we don't need a style element anymore.
|
||||
$editable.find('style').remove();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user