From f34cb00e98f2c72e68b69345bc91db74b21dbd36 Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Tue, 16 Feb 2021 15:08:39 +0300 Subject: [PATCH] [dark theme] hide theme's option for IE --- apps/common/main/lib/controller/Themes.js | 4 ++++ apps/documenteditor/main/app/controller/Main.js | 1 - apps/documenteditor/main/app/controller/Viewport.js | 2 +- apps/documenteditor/main/app/view/FileMenuPanels.js | 5 ++++- apps/presentationeditor/main/app/controller/Main.js | 1 - apps/presentationeditor/main/app/controller/Viewport.js | 2 +- apps/presentationeditor/main/app/view/FileMenuPanels.js | 6 +++++- apps/spreadsheeteditor/main/app/controller/Main.js | 1 - apps/spreadsheeteditor/main/app/controller/Viewport.js | 2 +- apps/spreadsheeteditor/main/app/view/FileMenuPanels.js | 6 +++++- 10 files changed, 21 insertions(+), 9 deletions(-) diff --git a/apps/common/main/lib/controller/Themes.js b/apps/common/main/lib/controller/Themes.js index 722f42cf7..1f09cb8a1 100644 --- a/apps/common/main/lib/controller/Themes.js +++ b/apps/common/main/lib/controller/Themes.js @@ -39,6 +39,10 @@ define([ // getComputedStyle(document.documentElement).getPropertyValue('--background-normal'); }, + available: function () { + return !Common.Utils.isIE; + }, + current: function () { return Common.localStorage.getItem('ui-theme', 'theme-light'); }, diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index bd3df33b7..e2a67324f 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -387,7 +387,6 @@ define([ this.appOptions.canFeatureComparison = !!this.api.asc_isSupportFeature("comparison"); this.appOptions.canFeatureContentControl = !!this.api.asc_isSupportFeature("content-controls"); this.appOptions.mentionShare = !((typeof (this.appOptions.customization) == 'object') && (this.appOptions.customization.mentionShare==false)); - this.appOptions.canChangeUITheme = true; this.appOptions.user.guest && this.appOptions.canRenameAnonymous && Common.NotificationCenter.on('user:rename', _.bind(this.showRenameUserDialog, this)); diff --git a/apps/documenteditor/main/app/controller/Viewport.js b/apps/documenteditor/main/app/controller/Viewport.js index e3728a889..4262f468d 100644 --- a/apps/documenteditor/main/app/controller/Viewport.js +++ b/apps/documenteditor/main/app/controller/Viewport.js @@ -313,7 +313,7 @@ define([ cls : 'btn-toolbar' })).on('click', _on_btn_zoom.bind(me, 'up')); - if ( config.canChangeUITheme ) { + if ( Common.UI.Themes.available() ) { var mnuitemDarkTheme = new Common.UI.MenuItem({ caption: me.header.textDarkTheme, checked: Common.UI.Themes.isDarkTheme(), diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index 15a47b721..757772616 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -244,7 +244,7 @@ define([ '', '','', /** coauthoring end **/ - '', + '', '', '', '','', @@ -535,6 +535,9 @@ define([ /** coauthoring end **/ $('tr.macros', this.el)[(mode.customization && mode.customization.macros===false) ? 'hide' : 'show'](); + if ( !Common.UI.Themes.available() ) { + $('tr.themes, tr.themes + tr.divider', this.el).hide(); + } }, setApi: function(o) { diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index c005f1997..ef200e2b0 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -345,7 +345,6 @@ define([ this.appOptions.compatibleFeatures = (typeof (this.appOptions.customization) == 'object') && !!this.appOptions.customization.compatibleFeatures; this.appOptions.canRequestSharingSettings = this.editorConfig.canRequestSharingSettings; this.appOptions.mentionShare = !((typeof (this.appOptions.customization) == 'object') && (this.appOptions.customization.mentionShare==false)); - this.appOptions.canChangeUITheme = true; this.appOptions.user.guest && this.appOptions.canRenameAnonymous && Common.NotificationCenter.on('user:rename', _.bind(this.showRenameUserDialog, this)); diff --git a/apps/presentationeditor/main/app/controller/Viewport.js b/apps/presentationeditor/main/app/controller/Viewport.js index 1627ca698..57d6e7337 100644 --- a/apps/presentationeditor/main/app/controller/Viewport.js +++ b/apps/presentationeditor/main/app/controller/Viewport.js @@ -316,7 +316,7 @@ define([ cls : 'btn-toolbar' })).on('click', _on_btn_zoom.bind(me, 'up')); - if ( config.canChangeUITheme ) { + if ( Common.UI.Themes.available() ) { var mnuitemDarkTheme = new Common.UI.MenuItem({ caption: me.header.textDarkTheme, checked: Common.UI.Themes.isDarkTheme(), diff --git a/apps/presentationeditor/main/app/view/FileMenuPanels.js b/apps/presentationeditor/main/app/view/FileMenuPanels.js index 6b6a3fbce..d11a5047d 100644 --- a/apps/presentationeditor/main/app/view/FileMenuPanels.js +++ b/apps/presentationeditor/main/app/view/FileMenuPanels.js @@ -214,7 +214,7 @@ define([ '', '','', /** coauthoring end **/ - '', + '', '', '', '','', @@ -471,6 +471,10 @@ define([ $('tr.coauth.changes', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring ? 'show' : 'hide'](); /** coauthoring end **/ $('tr.macros', this.el)[(mode.customization && mode.customization.macros===false) ? 'hide' : 'show'](); + + if ( !Common.UI.Themes.available() ) { + $('tr.themes, tr.themes + tr.divider', this.el).hide(); + } }, setApi: function(o) { diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index d1e10747d..9303a01b3 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -374,7 +374,6 @@ define([ this.appOptions.canMakeActionLink = this.editorConfig.canMakeActionLink; this.appOptions.canFeaturePivot = true; this.appOptions.canFeatureViews = !!this.api.asc_isSupportFeature("sheet-views"); - this.appOptions.canChangeUITheme = true; if (this.appOptions.user.guest && this.appOptions.canRenameAnonymous && !this.appOptions.isEditDiagram && !this.appOptions.isEditMailMerge) Common.NotificationCenter.on('user:rename', _.bind(this.showRenameUserDialog, this)); diff --git a/apps/spreadsheeteditor/main/app/controller/Viewport.js b/apps/spreadsheeteditor/main/app/controller/Viewport.js index 3d2042754..e4fda19c3 100644 --- a/apps/spreadsheeteditor/main/app/controller/Viewport.js +++ b/apps/spreadsheeteditor/main/app/controller/Viewport.js @@ -327,7 +327,7 @@ define([ cls : 'btn-toolbar' })).on('click', _on_btn_zoom.bind(me, 'up')); - if ( config.canChangeUITheme ) { + if ( Common.UI.Themes.available() ) { var mnuitemDarkTheme = new Common.UI.MenuItem({ caption: me.header.textDarkTheme, checked: Common.UI.Themes.isDarkTheme(), diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js index 91306012c..6223b070f 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js @@ -691,7 +691,7 @@ define([ '', '','', /** coauthoring end **/ - '', + '', '', '', '','', @@ -1080,6 +1080,10 @@ define([ $('tr.comments', this.el)[mode.canCoAuthoring ? 'show' : 'hide'](); $('tr.coauth.changes', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring? 'show' : 'hide'](); $('tr.macros', this.el)[(mode.customization && mode.customization.macros===false) ? 'hide' : 'show'](); + + if ( !Common.UI.Themes.available() ) { + $('tr.themes, tr.themes + tr.divider', this.el).hide(); + } }, setApi: function(api) {