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

View file

@ -372,6 +372,7 @@ define([
onThemeChanged: function (id) { onThemeChanged: function (id) {
var document = DE.getController('Main').document; var document = DE.getController('Main').document;
if ( !/^pdf|djvu|xps|oxps$/.test(document.fileType) ) { if ( !/^pdf|djvu|xps|oxps$/.test(document.fileType) ) {
if ( this.header.menuItemsDarkMode ) {
var current_dark = Common.UI.Themes.isDarkTheme(); var current_dark = Common.UI.Themes.isDarkTheme();
var menuItem = this.header.menuItemsDarkMode; var menuItem = this.header.menuItemsDarkMode;
menuItem.setVisible(current_dark); menuItem.setVisible(current_dark);
@ -379,6 +380,7 @@ define([
menuItem.setChecked(Common.UI.Themes.isContentThemeDark()); menuItem.setChecked(Common.UI.Themes.isContentThemeDark());
} }
}
}, },
onContentThemeChangedToDark: function (isdark) { onContentThemeChangedToDark: function (isdark) {