diff --git a/addons/web_editor/static/src/scss/bootstrap_overridden.scss b/addons/web_editor/static/src/scss/bootstrap_overridden.scss index f48d9bdaecb..6945a73299e 100644 --- a/addons/web_editor/static/src/scss/bootstrap_overridden.scss +++ b/addons/web_editor/static/src/scss/bootstrap_overridden.scss @@ -8,15 +8,17 @@ $colors: () !default; } $o-btn-bg-colors: () !default; -$o-btn-bg-colors: map-merge(( - 'primary': o-color('o-cc1-btn-primary'), - 'secondary': o-color('o-cc1-btn-secondary'), -), $o-btn-bg-colors); $o-btn-border-colors: () !default; -$o-btn-border-colors: map-merge(( - 'primary': o-color('o-cc1-btn-primary-border'), - 'secondary': o-color('o-cc1-btn-secondary-border'), -), $o-btn-border-colors); +@if not (variable-exists('prevent-backend-colors-alteration') and $prevent-backend-colors-alteration) { + $o-btn-bg-colors: map-merge(( + 'primary': o-color('o-cc1-btn-primary'), + 'secondary': o-color('o-cc1-btn-secondary'), + ), $o-btn-bg-colors); + $o-btn-border-colors: map-merge(( + 'primary': o-color('o-cc1-btn-primary-border'), + 'secondary': o-color('o-cc1-btn-secondary-border'), + ), $o-btn-border-colors); +} // Automatically extend bootstrap to create theme background/text/button classes $theme-colors: () !default; @@ -31,6 +33,13 @@ $grays: () !default; $grays: map-merge(('#{$name}': o-color($color)), $grays); } +// Detach colors that are used for backend UI (see comment linked to the +// prevent-backend-colors-alteration for more information) +@if variable-exists('prevent-backend-colors-alteration') and $prevent-backend-colors-alteration { + $theme-colors: map-remove($theme-colors, 'primary', 'secondary', 'success', 'info', 'warning', 'danger', 'light', 'dark'); + $grays: map-remove($grays, '100', '200', '300', '400', '500', '600', '700', '800', '900'); +} + // Bootstrap use standard variables to define individual colors which are then // placed into a map which is then used to get the value of each individual // color. As BS4 allows to extend the map a priori to define our own colors, diff --git a/addons/web_editor/static/src/scss/bootstrap_overridden_backend.scss b/addons/web_editor/static/src/scss/bootstrap_overridden_backend.scss index ef2d6cf03c5..335e8ffd13d 100644 --- a/addons/web_editor/static/src/scss/bootstrap_overridden_backend.scss +++ b/addons/web_editor/static/src/scss/bootstrap_overridden_backend.scss @@ -1,14 +1,15 @@ - -$o-theme-color-palette: map-remove($o-theme-color-palette, 'primary', 'secondary', 'success', 'info', 'warning', 'danger', 'light', 'dark'); -$o-gray-color-palette: map-remove($o-gray-color-palette, '100', '200', '300', '400', '500', '600', '700', '800', '900'); - -$o-btn-bg-colors: () !default; -$o-btn-bg-colors: map-merge(( - 'primary': null, - 'secondary': null, -), $o-btn-bg-colors); -$o-btn-border-colors: () !default; -$o-btn-border-colors: map-merge(( - 'primary': null, - 'secondary': null, -), $o-btn-border-colors); +// TODO the code linked to this variable should not be needed, this needs a lot +// of refactoring. Basically, "frontend" color (complex) maps are available +// in all assets (via the variables parts that all assets have in common). The +// original plan was for them to be used in shared "frontend" environment like +// the mass_mailing application. The web_editor SCSS generation uses those +// variables to customize bootstrap variables... but it conflicts with the +// backend also customizing those. In master it should be reviewed so that the +// web_editor probably does not touch any bootstrap variable when in a backend +// environment and/or some code should simply be moved to the website app only. +// In stable, this next code was made to "clean" what the web_editor alters when +// in a backend environment. +// See also web_editor.common.scss where many CSS rules depends on this and are +// available in the backend... while they probably should not. But in stable, +// we wanted to avoid changing too many things. +$prevent-backend-colors-alteration: true; diff --git a/addons/web_editor/static/src/scss/web_editor.common.scss b/addons/web_editor/static/src/scss/web_editor.common.scss index f9300b326b3..d292b94a1a2 100644 --- a/addons/web_editor/static/src/scss/web_editor.common.scss +++ b/addons/web_editor/static/src/scss/web_editor.common.scss @@ -1,5 +1,9 @@ /// -/// This file regroups basic style rules for web_editor enable page edition and backend utils. +/// This file regroups basic style rules for web_editor enable page edition and +/// backend utils. +/// TODO many of those rules should probably not be declared for the backend. +/// in particular the o_ccX rules, see code linked to the variable named +/// 'prevent-backend-colors-alteration'. /// :root {