mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-07-24 05:57:18 +08:00
@ -408,7 +408,7 @@ define([
|
||||
}
|
||||
} else
|
||||
if ( e.key == 'content-theme' ) {
|
||||
this.setContentTheme(e.originalEvent.newValue, true);
|
||||
this.setContentTheme(e.originalEvent.newValue, true, false);
|
||||
}
|
||||
}.bind(this))
|
||||
|
||||
@ -479,14 +479,15 @@ define([
|
||||
return window.uitheme.iscontentdark;
|
||||
},
|
||||
|
||||
setContentTheme: function (mode, force) {
|
||||
setContentTheme: function (mode, force, keep) {
|
||||
var set_dark = mode == 'dark';
|
||||
if ( set_dark != window.uitheme.iscontentdark || force ) {
|
||||
window.uitheme.iscontentdark = set_dark;
|
||||
|
||||
if ( this.isDarkTheme() )
|
||||
this.api.asc_setContentDarkMode(set_dark);
|
||||
|
||||
window.uitheme.iscontentdark = mode;
|
||||
if ( Common.localStorage.getItem('content-theme') != mode )
|
||||
if ( !(keep === false) && Common.localStorage.getItem('content-theme') != mode )
|
||||
Common.localStorage.setItem('content-theme', mode);
|
||||
|
||||
Common.NotificationCenter.trigger('contenttheme:dark', set_dark);
|
||||
|
||||
@ -297,8 +297,15 @@ define([
|
||||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||
},
|
||||
|
||||
onChangeDarkMode: function () {
|
||||
Common.UI.Themes.toggleContentTheme();
|
||||
onChangeDarkMode: function (isdarkmode) {
|
||||
if (!this._darkModeTimer) {
|
||||
var me = this;
|
||||
me._darkModeTimer = setTimeout(function() {
|
||||
me._darkModeTimer = undefined;
|
||||
}, 500);
|
||||
Common.UI.Themes.setContentTheme(isdarkmode?'dark':'light');
|
||||
} else
|
||||
this.onContentThemeChangedToDark(Common.UI.Themes.isContentThemeDark());
|
||||
},
|
||||
|
||||
onContentThemeChangedToDark: function (isdark) {
|
||||
|
||||
@ -131,8 +131,8 @@ define([
|
||||
me.chRightMenu.on('change', _.bind(function (checkbox, state) {
|
||||
me.fireEvent('rightmenu:hide', [me.chRightMenu, state === 'checked']);
|
||||
}, me));
|
||||
me.btnDarkDocument.on('click', _.bind(function () {
|
||||
me.fireEvent('darkmode:change');
|
||||
me.btnDarkDocument.on('click', _.bind(function (e) {
|
||||
me.fireEvent('darkmode:change', [e.pressed]);
|
||||
}, me));
|
||||
me.cmbsZoom.forEach(function (cmb) {
|
||||
cmb.on('combo:focusin', _.bind(me.onComboOpen, this, false));
|
||||
|
||||
@ -282,8 +282,15 @@ define([
|
||||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||
},
|
||||
|
||||
onChangeDarkMode: function () {
|
||||
Common.UI.Themes.toggleContentTheme();
|
||||
onChangeDarkMode: function (isdarkmode) {
|
||||
if (!this._darkModeTimer) {
|
||||
var me = this;
|
||||
me._darkModeTimer = setTimeout(function() {
|
||||
me._darkModeTimer = undefined;
|
||||
}, 500);
|
||||
Common.UI.Themes.setContentTheme(isdarkmode?'dark':'light');
|
||||
} else
|
||||
this.onContentThemeChangedToDark(Common.UI.Themes.isContentThemeDark());
|
||||
},
|
||||
|
||||
onContentThemeChangedToDark: function (isdark) {
|
||||
|
||||
@ -119,8 +119,8 @@ define([
|
||||
me.chLeftMenu.on('change', _.bind(function (checkbox, state) {
|
||||
me.fireEvent('leftmenu:hide', [me.chLeftMenu, state === 'checked']);
|
||||
}, me));
|
||||
me.btnDarkDocument.on('click', _.bind(function () {
|
||||
me.fireEvent('darkmode:change');
|
||||
me.btnDarkDocument.on('click', _.bind(function (e) {
|
||||
me.fireEvent('darkmode:change', [e.pressed]);
|
||||
}, me));
|
||||
me.cmbsZoom.forEach(function (cmb) {
|
||||
cmb.on('combo:focusin', _.bind(me.onComboOpen, this, false));
|
||||
|
||||
Reference in New Issue
Block a user