[themes] fix theme flashing when multiple editors open
This commit is contained in:
parent
2dfad6b6fa
commit
06deb0f09d
|
@ -413,10 +413,11 @@ define([
|
|||
Common.NotificationCenter.trigger('contenttheme:dark', !is_current_dark);
|
||||
},
|
||||
|
||||
setTheme: function (obj, force) {
|
||||
setTheme: function (obj) {
|
||||
if ( !obj ) return;
|
||||
|
||||
var id = get_ui_theme_name(obj);
|
||||
var id = get_ui_theme_name(obj),
|
||||
refresh_only = arguments[1];
|
||||
|
||||
if ( is_theme_type_system(id) ) {
|
||||
Common.localStorage.setBool('ui-theme-use-system', true);
|
||||
|
@ -425,7 +426,7 @@ define([
|
|||
Common.localStorage.setBool('ui-theme-use-system', false);
|
||||
}
|
||||
|
||||
if ( (this.currentThemeId() != id || force) && !!themes_map[id] ) {
|
||||
if ( (this.currentThemeId() != id || refresh_only) && !!themes_map[id] ) {
|
||||
document.body.className = document.body.className.replace(/theme-[\w-]+\s?/gi, '').trim();
|
||||
document.body.classList.add(id, 'theme-type-' + themes_map[id].type);
|
||||
|
||||
|
@ -456,9 +457,11 @@ define([
|
|||
theme_obj.colors = obj;
|
||||
}
|
||||
|
||||
if ( !refresh_only )
|
||||
Common.localStorage.setItem('ui-theme', JSON.stringify(theme_obj));
|
||||
}
|
||||
|
||||
if ( !refresh_only )
|
||||
Common.localStorage.setItem('ui-theme-id', id);
|
||||
Common.NotificationCenter.trigger('uitheme:changed', id);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue