From 10d7f8c179bf22ab75298aa79743b45a22d34085 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 29 Mar 2022 14:26:21 +0300 Subject: [PATCH] [DE] For Bug 56224 --- .../main/app/controller/LeftMenu.js | 4 ++ .../main/app/controller/Main.js | 9 ++++ .../main/app/view/FileMenuPanels.js | 43 +++++++++++++++++-- apps/documenteditor/main/locale/en.json | 2 + .../main/app/view/FileMenuPanels.js | 1 - 5 files changed, 55 insertions(+), 4 deletions(-) diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index d6e4cb81a..48d2fe9ed 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -493,6 +493,10 @@ 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); } 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 f49214895..eb1cc6956 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1167,6 +1167,15 @@ 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); + 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 9d7e9f768..1fe7287df 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -318,6 +318,12 @@ define([ '', '
', '', + '', + '', + '', + '', + '', + '', '', '', '', @@ -416,6 +422,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.chCompatible = new Common.UI.CheckBox({ @@ -780,8 +805,11 @@ define([ if (this.mode.canForcesave) this.chForcesave.setValue(Common.Utils.InternalSettings.get("de-settings-forcesave")); - if (Common.UI.FeaturesManager.canChange('spellcheck')) + if (Common.UI.FeaturesManager.canChange('spellcheck')) { this.chSpell.setValue(Common.Utils.InternalSettings.get("de-settings-spellcheck")); + this.chIgnoreUppercase.setValue(Common.Utils.InternalSettings.get("de-spellcheck-ignore-uppercase-words")); + this.chIgnoreNumbers.setValue(Common.Utils.InternalSettings.get("de-spellcheck-ignore-numbers-words")); + } this.chAlignGuides.setValue(Common.Utils.InternalSettings.get("de-settings-showsnaplines")); this.chCompatible.setValue(Common.Utils.InternalSettings.get("de-settings-compatible")); @@ -835,8 +863,15 @@ define([ Common.localStorage.setItem("de-settings-autosave", this.chAutosave.isChecked() ? 1 : 0); if (this.mode.canForcesave) Common.localStorage.setItem("de-settings-forcesave", this.chForcesave.isChecked() ? 1 : 0); - if (Common.UI.FeaturesManager.canChange('spellcheck')) + 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.setItem("de-settings-compatible", this.chCompatible.isChecked() ? 1 : 0); Common.Utils.InternalSettings.set("de-settings-compatible", this.chCompatible.isChecked() ? 1 : 0); Common.Utils.InternalSettings.set("de-settings-showsnaplines", this.chAlignGuides.isChecked()); @@ -951,7 +986,9 @@ define([ strShowComments: 'Show comments in text', strShowResolvedComments: 'Show resolved comments', 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' }, 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 63c6292e5..4516042ec 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -1799,6 +1799,8 @@ "DE.Views.FileMenuPanels.Settings.txtWarnMacrosDesc": "Disable all macros with a notification", "DE.Views.FileMenuPanels.Settings.txtWin": "as Windows", "DE.Views.FileMenuPanels.Settings.txtWorkspace": "Workspace", + "DE.Views.FileMenuPanels.Settings.strIgnoreWordsInUPPERCASE": "Ignore words in UPPERCASE", + "DE.Views.FileMenuPanels.Settings.strIgnoreWordsWithNumbers": "Ignore words with numbers", "DE.Views.FormSettings.textAlways": "Always", "DE.Views.FormSettings.textAspect": "Lock aspect ratio", "DE.Views.FormSettings.textAutofit": "AutoFit", diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js index eb5b6b202..31fbeeb3f 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js @@ -296,7 +296,6 @@ define([ '', '', '', - '', '', '',