From 4bed1f8ed6fb9a587cd1c8c49a444d9a0a2f6aa6 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 9 Dec 2021 18:23:59 +0300 Subject: [PATCH] [DE] Fix Bug 53938 --- .../main/app/view/FileMenuPanels.js | 24 ++++++++++++++++--- apps/documenteditor/main/locale/en.json | 1 + apps/documenteditor/main/locale/ru.json | 1 + 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index e9d686b3a..22b12c722 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -278,7 +278,9 @@ define([ /** coauthoring end **/ '', '', - '', + '', + '
', + '
', '','', '', '', @@ -547,6 +549,16 @@ define([ dataHint: '2', dataHintDirection: 'bottom', dataHintOffset: 'big' + }).on('selected', function(combo, record) { + me.chDarkMode.setDisabled(record.themeType!=='dark'); + }); + + this.chDarkMode = new Common.UI.CheckBox({ + el: $markup.findById('#fms-chb-dark-mode'), + labelText: this.txtDarkMode, + dataHint: '2', + dataHintDirection: 'left', + dataHintOffset: 'small' }); this.cmbReviewHover = new Common.UI.ComboBox({ @@ -636,6 +648,7 @@ define([ if ( !Common.UI.Themes.available() ) { $('tr.themes, tr.themes + tr.divider', this.el).hide(); } + this.chDarkMode.setVisible(!/^pdf|djvu|xps|oxps$/.test(DE.getController('Main').document.fileType)); }, setApi: function(o) { @@ -700,7 +713,7 @@ define([ var data = []; for (var t in Common.UI.Themes.map()) { - data.push({value: t, displayValue: Common.UI.Themes.get(t).text}); + data.push({value: t, displayValue: Common.UI.Themes.get(t).text, themeType: Common.UI.Themes.get(t).type}); } if ( data.length ) { @@ -708,6 +721,8 @@ define([ item = this.cmbTheme.store.findWhere({value: Common.UI.Themes.currentThemeId()}); this.cmbTheme.setValue(item ? item.get('value') : Common.UI.Themes.defaultThemeId()); } + this.chDarkMode.setValue(Common.UI.Themes.isContentThemeDark()); + this.chDarkMode.setDisabled(!Common.UI.Themes.isDarkTheme()); if (this.mode.canViewReview) { value = Common.Utils.InternalSettings.get("de-settings-review-hover-mode"); @@ -718,6 +733,8 @@ define([ applySettings: function() { Common.UI.Themes.setTheme(this.cmbTheme.getValue()); + if (!this.chDarkMode.isDisabled() && (this.chDarkMode.isChecked() !== Common.UI.Themes.isContentThemeDark())) + Common.UI.Themes.toggleContentTheme(); Common.localStorage.setItem("de-settings-inputmode", this.chInputMode.isChecked() ? 1 : 0); Common.localStorage.setItem("de-settings-zoom", this.cmbZoom.getValue()); Common.Utils.InternalSettings.set("de-settings-zoom", Common.localStorage.getItem("de-settings-zoom")); @@ -852,7 +869,8 @@ define([ txtAutoCorrect: 'AutoCorrect options...', strReviewHover: 'Track Changes Display', txtChangesTip: 'Show by hover in tooltips', - txtChangesBalloons: 'Show by click in balloons' + txtChangesBalloons: 'Show by click in balloons', + txtDarkMode: 'Turn on document dark mode' }, DE.Views.FileMenuPanels.Settings || {})); DE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({ diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 9a5790dd5..1a2547f54 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -1723,6 +1723,7 @@ "DE.Views.FileMenuPanels.Settings.strSpellCheckMode": "Turn on spell checking option", "DE.Views.FileMenuPanels.Settings.strStrict": "Strict", "DE.Views.FileMenuPanels.Settings.strTheme": "Interface theme", + "DE.Views.FileMenuPanels.Settings.txtDarkMode": "Turn on document dark mode", "DE.Views.FileMenuPanels.Settings.strUnit": "Unit of Measurement", "DE.Views.FileMenuPanels.Settings.strZoom": "Default Zoom Value", "DE.Views.FileMenuPanels.Settings.text10Minutes": "Every 10 Minutes", diff --git a/apps/documenteditor/main/locale/ru.json b/apps/documenteditor/main/locale/ru.json index c06afc532..99bda7908 100644 --- a/apps/documenteditor/main/locale/ru.json +++ b/apps/documenteditor/main/locale/ru.json @@ -1723,6 +1723,7 @@ "DE.Views.FileMenuPanels.Settings.strSpellCheckMode": "Включить проверку орфографии", "DE.Views.FileMenuPanels.Settings.strStrict": "Строгий", "DE.Views.FileMenuPanels.Settings.strTheme": "Тема интерфейса", + "DE.Views.FileMenuPanels.Settings.txtDarkMode": "Включить темный режим", "DE.Views.FileMenuPanels.Settings.strUnit": "Единица измерения", "DE.Views.FileMenuPanels.Settings.strZoom": "Стандартное значение масштаба", "DE.Views.FileMenuPanels.Settings.text10Minutes": "Каждые 10 минут",