diff --git a/apps/api/documents/index.html.desktop b/apps/api/documents/index.html.desktop index 881868143..8661e9b25 100644 --- a/apps/api/documents/index.html.desktop +++ b/apps/api/documents/index.html.desktop @@ -105,6 +105,7 @@ , feedback: { url: "https://helpdesk.onlyoffice.com/?desktop=true" } + , uiTheme: urlParams["uitheme"] }, mode : urlParams["mode"] || 'edit', lang : urlParams["lang"] || 'en', diff --git a/apps/common/main/lib/controller/Desktop.js b/apps/common/main/lib/controller/Desktop.js index 8b7e84641..1707c5965 100644 --- a/apps/common/main/lib/controller/Desktop.js +++ b/apps/common/main/lib/controller/Desktop.js @@ -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); + } }); } }, diff --git a/apps/common/main/lib/controller/Themes.js b/apps/common/main/lib/controller/Themes.js index 1856441a6..3dfdcec9b 100644 --- a/apps/common/main/lib/controller/Themes.js +++ b/apps/common/main/lib/controller/Themes.js @@ -76,7 +76,7 @@ define([ } Common.localStorage.setItem('ui-theme', name); - Common.NotificationCenter.trigger('uitheme:change', name); + Common.NotificationCenter.trigger('uitheme:changed', name); } }, diff --git a/apps/common/main/lib/util/htmlutils.js b/apps/common/main/lib/util/htmlutils.js index f6e5384c3..bbd155a77 100644 --- a/apps/common/main/lib/util/htmlutils.js +++ b/apps/common/main/lib/util/htmlutils.js @@ -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); }