[desktop] fix bug 53610
This commit is contained in:
parent
33c511c432
commit
ffbf529fe8
|
@ -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();
|
||||||
|
|
|
@ -372,12 +372,14 @@ 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) ) {
|
||||||
var current_dark = Common.UI.Themes.isDarkTheme();
|
if ( this.header.menuItemsDarkMode ) {
|
||||||
var menuItem = this.header.menuItemsDarkMode;
|
var current_dark = Common.UI.Themes.isDarkTheme();
|
||||||
menuItem.setVisible(current_dark);
|
var menuItem = this.header.menuItemsDarkMode;
|
||||||
menuItem.$el.prev('.divider')[current_dark ? 'show' : 'hide']();
|
menuItem.setVisible(current_dark);
|
||||||
|
menuItem.$el.prev('.divider')[current_dark ? 'show' : 'hide']();
|
||||||
|
|
||||||
menuItem.setChecked(Common.UI.Themes.isContentThemeDark());
|
menuItem.setChecked(Common.UI.Themes.isContentThemeDark());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue