From 4b2f5bbcd84757635b460b436521ce842f20b2c1 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Tue, 14 Dec 2021 14:25:50 +0300 Subject: [PATCH] [DE PE SSE] Fix changing of interface theme in view tab --- apps/documenteditor/main/app/controller/ViewTab.js | 11 +++++++++++ apps/documenteditor/main/app/view/ViewTab.js | 2 +- .../main/app/controller/ViewTab.js | 12 +++++++++++- .../spreadsheeteditor/main/app/controller/ViewTab.js | 11 +++++++++++ 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/apps/documenteditor/main/app/controller/ViewTab.js b/apps/documenteditor/main/app/controller/ViewTab.js index 36bed734a..36beb7c6d 100644 --- a/apps/documenteditor/main/app/controller/ViewTab.js +++ b/apps/documenteditor/main/app/controller/ViewTab.js @@ -60,6 +60,7 @@ define([ this._state = {}; Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); Common.NotificationCenter.on('contenttheme:dark', this.onContentThemeChangedToDark.bind(this)); + Common.NotificationCenter.on('uitheme:changed', this.onThemeChanged.bind(this)); }, setApi: function (api) { @@ -203,5 +204,15 @@ define([ this.view && this.view.btnDarkDocument.toggle(isdark, true); }, + onThemeChanged: function () { + if (this.view) { + var current_theme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId(), + menu_item = _.findWhere(this.view.btnInterfaceTheme.menu.items, {value: current_theme}); + this.view.btnInterfaceTheme.menu.clearAll(); + menu_item.setChecked(true, true); + this.view.btnDarkDocument.setDisabled(!Common.UI.Themes.isDarkTheme()); + } + }, + }, DE.Controllers.ViewTab || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/view/ViewTab.js b/apps/documenteditor/main/app/view/ViewTab.js index 5b58ab1d0..8e2710c58 100644 --- a/apps/documenteditor/main/app/view/ViewTab.js +++ b/apps/documenteditor/main/app/view/ViewTab.js @@ -49,7 +49,7 @@ define([ return { options: {}, - setEvents() { + setEvents: function () { var me = this; me.btnNavigation.on('click', function (btn, e) { me.fireEvent('viewtab:navigation', [btn.pressed]); diff --git a/apps/presentationeditor/main/app/controller/ViewTab.js b/apps/presentationeditor/main/app/controller/ViewTab.js index 124e05aff..dd0ebd423 100644 --- a/apps/presentationeditor/main/app/controller/ViewTab.js +++ b/apps/presentationeditor/main/app/controller/ViewTab.js @@ -62,6 +62,7 @@ define([ zoom_percent: undefined }; Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); + Common.NotificationCenter.on('uitheme:changed', this.onThemeChanged.bind(this)); }, setApi: function (api) { @@ -195,7 +196,16 @@ define([ Common.localStorage.setBool('pe-hidden-notes', !checked); this.view.fireEvent('notes:hide', [!checked]); Common.NotificationCenter.trigger('edit:complete', this.view); - } + }, + + onThemeChanged: function () { + if (this.view) { + var current_theme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId(), + menu_item = _.findWhere(this.view.btnInterfaceTheme.menu.items, {value: current_theme}); + this.view.btnInterfaceTheme.menu.clearAll(); + menu_item.setChecked(true, true); + } + }, }, PE.Controllers.ViewTab || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/controller/ViewTab.js b/apps/spreadsheeteditor/main/app/controller/ViewTab.js index 033dcab23..3558a6314 100644 --- a/apps/spreadsheeteditor/main/app/controller/ViewTab.js +++ b/apps/spreadsheeteditor/main/app/controller/ViewTab.js @@ -59,6 +59,7 @@ define([ }, onLaunch: function () { this._state = {}; + Common.NotificationCenter.on('uitheme:changed', this.onThemeChanged.bind(this)); }, setApi: function (api) { @@ -246,6 +247,16 @@ define([ onApiZoomChange: function(zf, type){ var value = Math.floor((zf + .005) * 100); this.view.cmbZoom.setValue(value, value + '%'); + }, + + onThemeChanged: function () { + if (this.view) { + var current_theme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId(), + menu_item = _.findWhere(this.view.btnInterfaceTheme.menu.items, {value: current_theme}); + this.view.btnInterfaceTheme.menu.clearAll(); + menu_item.setChecked(true, true); + } } + }, SSE.Controllers.ViewTab || {})); }); \ No newline at end of file