[desktop] fix bug 53610

This commit is contained in:
Maxim Kadushkin 2021-12-03 00:22:21 +03:00
parent 33c511c432
commit ffbf529fe8
2 changed files with 12 additions and 6 deletions

View file

@ -255,7 +255,9 @@ define([
$(window).on('storage', function (e) {
if ( e.key == 'ui-theme' || e.key == 'ui-theme-id' ) {
me.setTheme(e.originalEvent.newValue, true);
if ( !!t.originalEvent.newValue ) {
me.setTheme(t.originalEvent.newValue, true);
}
} else
if ( e.key == 'content-theme' ) {
me.setContentTheme(e.originalEvent.newValue, true);
@ -371,6 +373,8 @@ define([
},
setTheme: function (obj, force) {
if ( !obj ) return;
var id = get_ui_theme_name(obj);
if ( (this.currentThemeId() != id || force) && !!themes_map[id] ) {
document.body.className = document.body.className.replace(/theme-[\w-]+\s?/gi, '').trim();

View file

@ -372,12 +372,14 @@ define([
onThemeChanged: function (id) {
var document = DE.getController('Main').document;
if ( !/^pdf|djvu|xps|oxps$/.test(document.fileType) ) {
var current_dark = Common.UI.Themes.isDarkTheme();
var menuItem = this.header.menuItemsDarkMode;
menuItem.setVisible(current_dark);
menuItem.$el.prev('.divider')[current_dark ? 'show' : 'hide']();
if ( this.header.menuItemsDarkMode ) {
var current_dark = Common.UI.Themes.isDarkTheme();
var menuItem = this.header.menuItemsDarkMode;
menuItem.setVisible(current_dark);
menuItem.$el.prev('.divider')[current_dark ? 'show' : 'hide']();
menuItem.setChecked(Common.UI.Themes.isContentThemeDark());
menuItem.setChecked(Common.UI.Themes.isContentThemeDark());
}
}
},