From 12107a4e5fb131bab9200f03dd09879f08f50176 Mon Sep 17 00:00:00 2001 From: Antoine Guenet Date: Fri, 29 Apr 2022 15:20:25 +0000 Subject: [PATCH] [FIX] mass_mailing: properly parse all values in design tab The default values of borders for buttons were not properly parsed in the design tab because they come from the `btn` class, which was not part of the selectors for buttons in the design tab. The fake element created to get computed styles therefore didn't have that class and thus didn't have a border value. The separator width value was also broken whenever it was "auto" since we're expecting values of "25%", "50%", "75%" or "100%". This interprets "auto" as equivalent to "100%" in all cases. closes odoo/odoo#92138 X-original-commit: 56521a69d9cb61ec726722a2b102150bb1714070 Related: odoo/enterprise#27708 Signed-off-by: David Monjoie (dmo) Signed-off-by: Antoine Guenet --- .../src/js/mass_mailing_design_constants.js | 4 +-- .../static/src/js/mass_mailing_snippets.js | 2 ++ addons/mass_mailing/views/snippets_themes.xml | 32 +++++++++---------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/addons/mass_mailing/static/src/js/mass_mailing_design_constants.js b/addons/mass_mailing/static/src/js/mass_mailing_design_constants.js index a5bcc187249..ed4a837608f 100644 --- a/addons/mass_mailing/static/src/js/mass_mailing_design_constants.js +++ b/addons/mass_mailing/static/src/js/mass_mailing_design_constants.js @@ -26,8 +26,8 @@ export const PRIORITY_STYLES = { 'h3': ['font-family'], 'p': ['font-family'], 'a:not(.btn)': [], - 'a.btn-primary': [], - 'a.btn-secondary': [], + 'a.btn.btn-primary': [], + 'a.btn.btn-secondary': [], 'hr': [], }; export const RE_CSS_TEXT_MATCH = /([^{]+)([^}]+)/; diff --git a/addons/mass_mailing/static/src/js/mass_mailing_snippets.js b/addons/mass_mailing/static/src/js/mass_mailing_snippets.js index 1553e09536f..cabe4eb8cc5 100644 --- a/addons/mass_mailing/static/src/js/mass_mailing_snippets.js +++ b/addons/mass_mailing/static/src/js/mass_mailing_snippets.js @@ -358,6 +358,8 @@ options.registry.DesignTab = options.Class.extend({ } if (params.cssProperty === 'font-weight') { res = parseInt(res) >= 600 ? 'bolder' : ''; + } else if (res === 'auto') { + res = '100%'; } } fakeElement.remove(); diff --git a/addons/mass_mailing/views/snippets_themes.xml b/addons/mass_mailing/views/snippets_themes.xml index 7399d328cc1..030ad054e5c 100644 --- a/addons/mass_mailing/views/snippets_themes.xml +++ b/addons/mass_mailing/views/snippets_themes.xml @@ -670,32 +670,32 @@ - + Small Medium Large @@ -703,9 +703,9 @@ - +
@@ -721,7 +721,7 @@ @@ -729,20 +729,20 @@ - + Small Medium Large @@ -750,9 +750,9 @@ - +
@@ -768,7 +768,7 @@