[DE] apply document content mode in all opened tabs
This commit is contained in:
parent
85f7f03f0c
commit
540a415826
|
@ -251,6 +251,10 @@ define([
|
|||
$(window).on('storage', function (e) {
|
||||
if ( e.key == 'ui-theme' || e.key == 'ui-theme-id' ) {
|
||||
me.setTheme(e.originalEvent.newValue, true);
|
||||
} else
|
||||
if ( e.key == 'content-theme' ) {
|
||||
me.setContentTheme(e.originalEvent.newValue, true);
|
||||
console.log('changed content', e.originalEvent.newValue);
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -335,6 +339,22 @@ define([
|
|||
return Common.localStorage.getItem("content-theme") == 'dark';
|
||||
},
|
||||
|
||||
setContentTheme: function (mode, force) {
|
||||
var set_dark = mode == 'dark';
|
||||
if ( set_dark && !this.isDarkTheme() )
|
||||
return;
|
||||
|
||||
if ( set_dark != this.isContentThemeDark() || force ) {
|
||||
if ( this.api.asc_setContentDarkMode )
|
||||
this.api.asc_setContentDarkMode(set_dark);
|
||||
|
||||
if ( Common.localStorage.getItem('content-theme') != mode )
|
||||
Common.localStorage.setItem('content-theme', mode);
|
||||
|
||||
Common.NotificationCenter.trigger('contenttheme:dark', set_dark);
|
||||
}
|
||||
},
|
||||
|
||||
toggleContentTheme: function () {
|
||||
var is_current_dark = this.isContentThemeDark();
|
||||
is_current_dark ? Common.localStorage.setItem('content-theme', 'light') : Common.localStorage.setItem('content-theme', 'dark');
|
||||
|
|
Loading…
Reference in a new issue