From eef1a4af569f89ab45f91317c8bb1971afd02840 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 29 Mar 2022 17:51:33 +0300 Subject: [PATCH] [DE][PE] For Bug 56224 --- .../main/app/controller/LeftMenu.js | 12 ++++-- .../main/app/controller/Main.js | 18 +++++---- .../main/app/view/FileMenuPanels.js | 8 +--- .../main/app/controller/LeftMenu.js | 8 ++++ .../main/app/controller/Main.js | 11 ++++++ .../main/app/view/FileMenuPanels.js | 39 +++++++++++++++++-- apps/presentationeditor/main/locale/en.json | 2 + 7 files changed, 77 insertions(+), 21 deletions(-) diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index 48d2fe9ed..79efd4733 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -493,10 +493,14 @@ define([ value = Common.localStorage.getBool("de-settings-spellcheck", true); Common.Utils.InternalSettings.set("de-settings-spellcheck", value); this.api.asc_setSpellCheck(value); - value = new AscCommon.CSpellCheckSettings(); - value.put_IgnoreWordsInUppercase(Common.localStorage.getBool("de-spellcheck-ignore-uppercase-words")); - value.put_IgnoreWordsWithNumbers(Common.localStorage.getBool("de-spellcheck-ignore-numbers-words")); - this.api.asc_setSpellCheckSettings(value); + var spprops = new AscCommon.CSpellCheckSettings(); + value = Common.localStorage.getBool("de-spellcheck-ignore-uppercase-words", true); + Common.Utils.InternalSettings.set("de-spellcheck-ignore-uppercase-words", value); + spprops.put_IgnoreWordsInUppercase(value); + value = Common.localStorage.getBool("de-spellcheck-ignore-numbers-words", true); + Common.Utils.InternalSettings.set("de-spellcheck-ignore-numbers-words", value); + spprops.put_IgnoreWordsWithNumbers(value); + this.api.asc_setSpellCheckSettings(spprops); } value = parseInt(Common.localStorage.getItem("de-settings-paste-button")); diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index eb1cc6956..2040262e7 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1167,14 +1167,16 @@ define([ me.api.asc_setSpellCheck(value); Common.NotificationCenter.trigger('spelling:turn', value ? 'on' : 'off', true); // only toggle buttons - value = Common.localStorage.getBool("de-spellcheck-ignore-uppercase-words", false); - Common.Utils.InternalSettings.set("de-spellcheck-ignore-uppercase-words", value); - value = Common.localStorage.getBool("de-spellcheck-ignore-numbers-words", false); - Common.Utils.InternalSettings.set("de-spellcheck-ignore-numbers-words", value); - value = new AscCommon.CSpellCheckSettings(); - value.put_IgnoreWordsInUppercase(Common.Utils.InternalSettings.get("de-spellcheck-ignore-uppercase-words")); - value.put_IgnoreWordsWithNumbers(Common.Utils.InternalSettings.get("de-spellcheck-ignore-numbers-words")); - this.api.asc_setSpellCheckSettings(value); + if (Common.UI.FeaturesManager.canChange('spellcheck')) { // get settings for spellcheck from local storage + value = Common.localStorage.getBool("de-spellcheck-ignore-uppercase-words", true); + Common.Utils.InternalSettings.set("de-spellcheck-ignore-uppercase-words", value); + value = Common.localStorage.getBool("de-spellcheck-ignore-numbers-words", true); + Common.Utils.InternalSettings.set("de-spellcheck-ignore-numbers-words", value); + value = new AscCommon.CSpellCheckSettings(); + value.put_IgnoreWordsInUppercase(Common.Utils.InternalSettings.get("de-spellcheck-ignore-uppercase-words")); + value.put_IgnoreWordsWithNumbers(Common.Utils.InternalSettings.get("de-spellcheck-ignore-numbers-words")); + this.api.asc_setSpellCheckSettings(value); + } value = Common.localStorage.getBool("de-settings-compatible", false); Common.Utils.InternalSettings.set("de-settings-compatible", value); diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index 1fe7287df..f12ea2fb0 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -865,12 +865,8 @@ define([ Common.localStorage.setItem("de-settings-forcesave", this.chForcesave.isChecked() ? 1 : 0); if (Common.UI.FeaturesManager.canChange('spellcheck') && this.mode.isEdit) { Common.localStorage.setItem("de-settings-spellcheck", this.chSpell.isChecked() ? 1 : 0); - var value = this.chIgnoreUppercase.isChecked(); - Common.localStorage.setBool("de-spellcheck-ignore-uppercase-words", value); - Common.Utils.InternalSettings.set("de-spellcheck-ignore-uppercase-words", value); - value = this.chIgnoreNumbers.isChecked(); - Common.localStorage.setBool("de-spellcheck-ignore-numbers-words", value); - Common.Utils.InternalSettings.set("de-spellcheck-ignore-numbers-words", value); + Common.localStorage.setBool("de-spellcheck-ignore-uppercase-words", this.chIgnoreUppercase.isChecked()); + Common.localStorage.setBool("de-spellcheck-ignore-numbers-words", this.chIgnoreNumbers.isChecked()); } Common.localStorage.setItem("de-settings-compatible", this.chCompatible.isChecked() ? 1 : 0); Common.Utils.InternalSettings.set("de-settings-compatible", this.chCompatible.isChecked() ? 1 : 0); diff --git a/apps/presentationeditor/main/app/controller/LeftMenu.js b/apps/presentationeditor/main/app/controller/LeftMenu.js index 14ce12c89..9a9837ba7 100644 --- a/apps/presentationeditor/main/app/controller/LeftMenu.js +++ b/apps/presentationeditor/main/app/controller/LeftMenu.js @@ -371,6 +371,14 @@ define([ value = Common.localStorage.getBool("pe-settings-spellcheck", true); Common.Utils.InternalSettings.set("pe-settings-spellcheck", value); this.api.asc_setSpellCheck(value); + var spprops = new AscCommon.CSpellCheckSettings(); + value = Common.localStorage.getBool("pe-spellcheck-ignore-uppercase-words", true); + Common.Utils.InternalSettings.set("pe-spellcheck-ignore-uppercase-words", value); + spprops.put_IgnoreWordsInUppercase(value); + value = Common.localStorage.getBool("pe-spellcheck-ignore-numbers-words", true); + Common.Utils.InternalSettings.set("pe-spellcheck-ignore-numbers-words", value); + spprops.put_IgnoreWordsWithNumbers(value); + this.api.asc_setSpellCheckSettings(spprops); } value = parseInt(Common.localStorage.getItem("pe-settings-paste-button")); diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index f6acea3e2..679b38131 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -802,6 +802,17 @@ define([ me.api.asc_setSpellCheck(value); Common.NotificationCenter.trigger('spelling:turn', value ? 'on' : 'off', true); // only toggle buttons + if (Common.UI.FeaturesManager.canChange('spellcheck')) { // get settings for spellcheck from local storage + value = Common.localStorage.getBool("pe-spellcheck-ignore-uppercase-words", true); + Common.Utils.InternalSettings.set("pe-spellcheck-ignore-uppercase-words", value); + value = Common.localStorage.getBool("pe-spellcheck-ignore-numbers-words", true); + Common.Utils.InternalSettings.set("pe-spellcheck-ignore-numbers-words", value); + value = new AscCommon.CSpellCheckSettings(); + value.put_IgnoreWordsInUppercase(Common.Utils.InternalSettings.get("pe-spellcheck-ignore-uppercase-words")); + value.put_IgnoreWordsWithNumbers(Common.Utils.InternalSettings.get("pe-spellcheck-ignore-numbers-words")); + this.api.asc_setSpellCheckSettings(value); + } + value = Common.localStorage.getBool('pe-hidden-notes', this.appOptions.customization && this.appOptions.customization.hideNotes===true); me.api.asc_ShowNotes(!value); diff --git a/apps/presentationeditor/main/app/view/FileMenuPanels.js b/apps/presentationeditor/main/app/view/FileMenuPanels.js index a566631be..6f716a269 100644 --- a/apps/presentationeditor/main/app/view/FileMenuPanels.js +++ b/apps/presentationeditor/main/app/view/FileMenuPanels.js @@ -240,6 +240,12 @@ define([ '', '
', '', + '', + '', + '', + '', + '', + '', '', '', '', @@ -307,6 +313,25 @@ define([ dataHint: '2', dataHintDirection: 'left', dataHintOffset: 'small' + }).on('change', function(field, newValue, oldValue, eOpts){ + me.chIgnoreUppercase.setDisabled(field.getValue()!=='checked'); + me.chIgnoreNumbers.setDisabled(field.getValue()!=='checked'); + }); + + this.chIgnoreUppercase = new Common.UI.CheckBox({ + el: $markup.findById('#fms-chb-ignore-uppercase-words'), + labelText: this.strIgnoreWordsInUPPERCASE, + dataHint: '2', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + + this.chIgnoreNumbers = new Common.UI.CheckBox({ + el: $markup.findById('#fms-chb-ignore-numbers-words'), + labelText: this.strIgnoreWordsWithNumbers, + dataHint: '2', + dataHintDirection: 'left', + dataHintOffset: 'small' }); this.chInputMode = new Common.UI.CheckBox({ @@ -567,8 +592,11 @@ define([ }, updateSettings: function() { - if (Common.UI.FeaturesManager.canChange('spellcheck')) + if (Common.UI.FeaturesManager.canChange('spellcheck')) { this.chSpell.setValue(Common.Utils.InternalSettings.get("pe-settings-spellcheck")); + this.chIgnoreUppercase.setValue(Common.Utils.InternalSettings.get("pe-spellcheck-ignore-uppercase-words")); + this.chIgnoreNumbers.setValue(Common.Utils.InternalSettings.get("pe-spellcheck-ignore-numbers-words")); + } this.chInputMode.setValue(Common.Utils.InternalSettings.get("pe-settings-inputmode")); @@ -627,8 +655,11 @@ define([ applySettings: function() { Common.UI.Themes.setTheme(this.cmbTheme.getValue()); - if (Common.UI.FeaturesManager.canChange('spellcheck')) + if (Common.UI.FeaturesManager.canChange('spellcheck') && this.mode.isEdit) { Common.localStorage.setItem("pe-settings-spellcheck", this.chSpell.isChecked() ? 1 : 0); + Common.localStorage.setBool("pe-spellcheck-ignore-uppercase-words", this.chIgnoreUppercase.isChecked()); + Common.localStorage.setBool("pe-spellcheck-ignore-numbers-words", this.chIgnoreNumbers.isChecked()); + } Common.localStorage.setItem("pe-settings-inputmode", this.chInputMode.isChecked() ? 1 : 0); Common.localStorage.setItem("pe-settings-zoom", this.cmbZoom.getValue()); Common.Utils.InternalSettings.set("pe-settings-zoom", Common.localStorage.getItem("pe-settings-zoom")); @@ -724,7 +755,9 @@ define([ txtWorkspace: 'Workspace', txtHieroglyphs: 'Hieroglyphs', txtFastTip: 'Real-time co-editing. All changes are saved automatically', - txtStrictTip: 'Use the \'Save\' button to sync the changes you and others make' + txtStrictTip: 'Use the \'Save\' button to sync the changes you and others make', + strIgnoreWordsInUPPERCASE: 'Ignore words in UPPERCASE', + strIgnoreWordsWithNumbers: 'Ignore words with numbers' }, PE.Views.FileMenuPanels.Settings || {})); PE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({ diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index 036dce8cd..56efcdd45 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -1656,6 +1656,8 @@ "PE.Views.FileMenuPanels.Settings.txtWarnMacrosDesc": "Disable all macros with a notification", "PE.Views.FileMenuPanels.Settings.txtWin": "as Windows", "PE.Views.FileMenuPanels.Settings.txtWorkspace": "Workspace", + "PE.Views.FileMenuPanels.Settings.strIgnoreWordsInUPPERCASE": "Ignore words in UPPERCASE", + "PE.Views.FileMenuPanels.Settings.strIgnoreWordsWithNumbers": "Ignore words with numbers", "PE.Views.HeaderFooterDialog.applyAllText": "Apply to all", "PE.Views.HeaderFooterDialog.applyText": "Apply", "PE.Views.HeaderFooterDialog.diffLanguage": "You can’t use a date format in a different language than the slide master.
To change the master, click 'Apply to all' instead of 'Apply'",