Skip to content

Commit

Permalink
[FIX] web_editor: properly convert css margin if also inline margin
Browse files Browse the repository at this point in the history
When inlining styles for e-mails, some styles could be lost if they were
defined in css but also had an inline style that started with the same
characters. For example, a node with a style attribute defining
`margin-top: 10px` and a css style defining `margin: 5px` would end up
with `margin-top: 10px` and losing the rest of the information.

opw-3650141

closes #156136

X-original-commit: f2d2531
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet (age) <age@odoo.com>
  • Loading branch information
Zynton committed Mar 4, 2024
1 parent b623cf6 commit 35a8d55
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion addons/web_editor/static/src/js/backend/convert_inline.js
Expand Up @@ -425,7 +425,7 @@ function classToStyle($editable, cssRules) {
// Outlook doesn't support inline !important
style = style.replace(/!important/g,'');
for (const [key, value] of Object.entries(css)) {
if (!(new RegExp(`(^|;)\\s*${key}`).test(style))) {
if (!(new RegExp(`(^|;)\\s*${key}[ :]`).test(style))) {
style = `${key}:${value};${style}`;
}
};
Expand Down

0 comments on commit 35a8d55

Please sign in to comment.