[dark theme] changes for desktop app

This commit is contained in:
Maxim Kadushkin 2021-02-24 23:34:05 +03:00
parent b4814420f7
commit 683a87fbe5
4 changed files with 12 additions and 2 deletions

View file

@ -105,6 +105,7 @@
, feedback: {
url: "https://helpdesk.onlyoffice.com/?desktop=true"
}
, uiTheme: urlParams["uitheme"]
},
mode : urlParams["mode"] || 'edit',
lang : urlParams["lang"] || 'en',

View file

@ -115,6 +115,9 @@ define([
titlebuttons[obj.action].btn.click();
}
} else
if (/theme:changed/.test(cmd)) {
Common.UI.Themes.setTheme(param);
} else
if (/element:show/.test(cmd)) {
var _mr = /title:(?:(true|show)|(false|hide))/.exec(param);
if ( _mr ) {
@ -235,6 +238,9 @@ define([
Common.NotificationCenter.on({
'modal:show': _onModalDialog.bind(this, 'open'),
'modal:close': _onModalDialog.bind(this, 'close')
, 'uitheme:changed' : function (name) {
native.execCommand("uitheme:changed", name);
}
});
}
},

View file

@ -76,7 +76,7 @@ define([
}
Common.localStorage.setItem('ui-theme', name);
Common.NotificationCenter.trigger('uitheme:change', name);
Common.NotificationCenter.trigger('uitheme:changed', name);
}
},

View file

@ -32,7 +32,10 @@ var params = (function() {
return urlParams;
})();
var ui_theme_name = params.uitheme || localStorage.getItem("ui-theme");
if ( !!params.uitheme && localStorage.getItem("ui-theme") != params.uitheme)
localStorage.setItem("ui-theme", params.uitheme);
var ui_theme_name = localStorage.getItem("ui-theme");
if ( !!ui_theme_name ) {
document.body.classList.add(ui_theme_name);
}