Merge pull request #1663 from ONLYOFFICE/feature/bug-56224

Feature/bug 56224
This commit is contained in:
Julia Radzhabova 2022-03-29 19:12:18 +03:00 committed by GitHub
commit 1413c13ded
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 114 additions and 7 deletions

View file

@ -493,6 +493,14 @@ define([
value = Common.localStorage.getBool("de-settings-spellcheck", true); value = Common.localStorage.getBool("de-settings-spellcheck", true);
Common.Utils.InternalSettings.set("de-settings-spellcheck", value); Common.Utils.InternalSettings.set("de-settings-spellcheck", value);
this.api.asc_setSpellCheck(value); this.api.asc_setSpellCheck(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")); value = parseInt(Common.localStorage.getItem("de-settings-paste-button"));

View file

@ -1167,6 +1167,17 @@ define([
me.api.asc_setSpellCheck(value); me.api.asc_setSpellCheck(value);
Common.NotificationCenter.trigger('spelling:turn', value ? 'on' : 'off', true); // only toggle buttons 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("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); value = Common.localStorage.getBool("de-settings-compatible", false);
Common.Utils.InternalSettings.set("de-settings-compatible", value); Common.Utils.InternalSettings.set("de-settings-compatible", value);

View file

@ -318,6 +318,12 @@ define([
'<tr class="edit spellcheck">', '<tr class="edit spellcheck">',
'<td colspan="2"><div id="fms-chb-spell-check"></div></td>', '<td colspan="2"><div id="fms-chb-spell-check"></div></td>',
'</tr>', '</tr>',
'<tr class="edit spellcheck">',
'<td colspan="2"><span id="fms-chb-ignore-uppercase-words"></span></td>',
'</tr>',
'<tr class="edit spellcheck">',
'<td colspan="2"><span id="fms-chb-ignore-numbers-words"></span></td>',
'</tr>',
'<tr class="edit">', '<tr class="edit">',
'<td colspan="2"><button type="button" class="btn btn-text-default" id="fms-btn-auto-correct" style="width:auto; display: inline-block;padding-right: 10px;padding-left: 10px;" data-hint="2" data-hint-direction="bottom" data-hint-offset="medium"><%= scope.txtAutoCorrect %></button></div></td>', '<td colspan="2"><button type="button" class="btn btn-text-default" id="fms-btn-auto-correct" style="width:auto; display: inline-block;padding-right: 10px;padding-left: 10px;" data-hint="2" data-hint-direction="bottom" data-hint-offset="medium"><%= scope.txtAutoCorrect %></button></div></td>',
'</tr>', '</tr>',
@ -416,6 +422,25 @@ define([
dataHint: '2', dataHint: '2',
dataHintDirection: 'left', dataHintDirection: 'left',
dataHintOffset: 'small' 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({ this.chCompatible = new Common.UI.CheckBox({
@ -780,8 +805,11 @@ define([
if (this.mode.canForcesave) if (this.mode.canForcesave)
this.chForcesave.setValue(Common.Utils.InternalSettings.get("de-settings-forcesave")); 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.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.chAlignGuides.setValue(Common.Utils.InternalSettings.get("de-settings-showsnaplines"));
this.chCompatible.setValue(Common.Utils.InternalSettings.get("de-settings-compatible")); this.chCompatible.setValue(Common.Utils.InternalSettings.get("de-settings-compatible"));
@ -835,8 +863,11 @@ define([
Common.localStorage.setItem("de-settings-autosave", this.chAutosave.isChecked() ? 1 : 0); Common.localStorage.setItem("de-settings-autosave", this.chAutosave.isChecked() ? 1 : 0);
if (this.mode.canForcesave) if (this.mode.canForcesave)
Common.localStorage.setItem("de-settings-forcesave", this.chForcesave.isChecked() ? 1 : 0); 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); Common.localStorage.setItem("de-settings-spellcheck", this.chSpell.isChecked() ? 1 : 0);
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.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-compatible", this.chCompatible.isChecked() ? 1 : 0);
Common.Utils.InternalSettings.set("de-settings-showsnaplines", this.chAlignGuides.isChecked()); Common.Utils.InternalSettings.set("de-settings-showsnaplines", this.chAlignGuides.isChecked());
@ -951,7 +982,9 @@ define([
strShowComments: 'Show comments in text', strShowComments: 'Show comments in text',
strShowResolvedComments: 'Show resolved comments', strShowResolvedComments: 'Show resolved comments',
txtFastTip: 'Real-time co-editing. All changes are saved automatically', 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.Settings || {}));
DE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({ DE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({

View file

@ -1799,6 +1799,8 @@
"DE.Views.FileMenuPanels.Settings.txtWarnMacrosDesc": "Disable all macros with a notification", "DE.Views.FileMenuPanels.Settings.txtWarnMacrosDesc": "Disable all macros with a notification",
"DE.Views.FileMenuPanels.Settings.txtWin": "as Windows", "DE.Views.FileMenuPanels.Settings.txtWin": "as Windows",
"DE.Views.FileMenuPanels.Settings.txtWorkspace": "Workspace", "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.textAlways": "Always",
"DE.Views.FormSettings.textAspect": "Lock aspect ratio", "DE.Views.FormSettings.textAspect": "Lock aspect ratio",
"DE.Views.FormSettings.textAutofit": "AutoFit", "DE.Views.FormSettings.textAutofit": "AutoFit",

View file

@ -371,6 +371,14 @@ define([
value = Common.localStorage.getBool("pe-settings-spellcheck", true); value = Common.localStorage.getBool("pe-settings-spellcheck", true);
Common.Utils.InternalSettings.set("pe-settings-spellcheck", value); Common.Utils.InternalSettings.set("pe-settings-spellcheck", value);
this.api.asc_setSpellCheck(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")); value = parseInt(Common.localStorage.getItem("pe-settings-paste-button"));

View file

@ -802,6 +802,17 @@ define([
me.api.asc_setSpellCheck(value); me.api.asc_setSpellCheck(value);
Common.NotificationCenter.trigger('spelling:turn', value ? 'on' : 'off', true); // only toggle buttons 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); value = Common.localStorage.getBool('pe-hidden-notes', this.appOptions.customization && this.appOptions.customization.hideNotes===true);
me.api.asc_ShowNotes(!value); me.api.asc_ShowNotes(!value);

View file

@ -240,6 +240,12 @@ define([
'<tr class="edit spellcheck">', '<tr class="edit spellcheck">',
'<td colspan="2"><div id="fms-chb-spell-check"></div></td>', '<td colspan="2"><div id="fms-chb-spell-check"></div></td>',
'</tr>', '</tr>',
'<tr class="edit spellcheck">',
'<td colspan="2"><span id="fms-chb-ignore-uppercase-words"></span></td>',
'</tr>',
'<tr class="edit spellcheck">',
'<td colspan="2"><span id="fms-chb-ignore-numbers-words"></span></td>',
'</tr>',
'<tr class="edit">', '<tr class="edit">',
'<td colspan="2"><button type="button" class="btn btn-text-default" id="fms-btn-auto-correct" style="width:auto; display: inline-block;padding-right: 10px;padding-left: 10px;" data-hint="2" data-hint-direction="bottom" data-hint-offset="medium"><%= scope.txtAutoCorrect %></button></div></td>', '<td colspan="2"><button type="button" class="btn btn-text-default" id="fms-btn-auto-correct" style="width:auto; display: inline-block;padding-right: 10px;padding-left: 10px;" data-hint="2" data-hint-direction="bottom" data-hint-offset="medium"><%= scope.txtAutoCorrect %></button></div></td>',
'</tr>', '</tr>',
@ -307,6 +313,25 @@ define([
dataHint: '2', dataHint: '2',
dataHintDirection: 'left', dataHintDirection: 'left',
dataHintOffset: 'small' 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({ this.chInputMode = new Common.UI.CheckBox({
@ -567,8 +592,11 @@ define([
}, },
updateSettings: function() { 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.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")); this.chInputMode.setValue(Common.Utils.InternalSettings.get("pe-settings-inputmode"));
@ -627,8 +655,11 @@ define([
applySettings: function() { applySettings: function() {
Common.UI.Themes.setTheme(this.cmbTheme.getValue()); 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.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-inputmode", this.chInputMode.isChecked() ? 1 : 0);
Common.localStorage.setItem("pe-settings-zoom", this.cmbZoom.getValue()); Common.localStorage.setItem("pe-settings-zoom", this.cmbZoom.getValue());
Common.Utils.InternalSettings.set("pe-settings-zoom", Common.localStorage.getItem("pe-settings-zoom")); Common.Utils.InternalSettings.set("pe-settings-zoom", Common.localStorage.getItem("pe-settings-zoom"));
@ -724,7 +755,9 @@ define([
txtWorkspace: 'Workspace', txtWorkspace: 'Workspace',
txtHieroglyphs: 'Hieroglyphs', txtHieroglyphs: 'Hieroglyphs',
txtFastTip: 'Real-time co-editing. All changes are saved automatically', 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.Settings || {}));
PE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({ PE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({

View file

@ -1656,6 +1656,8 @@
"PE.Views.FileMenuPanels.Settings.txtWarnMacrosDesc": "Disable all macros with a notification", "PE.Views.FileMenuPanels.Settings.txtWarnMacrosDesc": "Disable all macros with a notification",
"PE.Views.FileMenuPanels.Settings.txtWin": "as Windows", "PE.Views.FileMenuPanels.Settings.txtWin": "as Windows",
"PE.Views.FileMenuPanels.Settings.txtWorkspace": "Workspace", "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.applyAllText": "Apply to all",
"PE.Views.HeaderFooterDialog.applyText": "Apply", "PE.Views.HeaderFooterDialog.applyText": "Apply",
"PE.Views.HeaderFooterDialog.diffLanguage": "You cant use a date format in a different language than the slide master.<br>To change the master, click 'Apply to all' instead of 'Apply'", "PE.Views.HeaderFooterDialog.diffLanguage": "You cant use a date format in a different language than the slide master.<br>To change the master, click 'Apply to all' instead of 'Apply'",

View file

@ -296,7 +296,6 @@ define([
'<td><span id="fms-cmb-dictionary-language"></span></td>', '<td><span id="fms-cmb-dictionary-language"></span></td>',
'</tr>', '</tr>',
'<tr class="spellcheck">', '<tr class="spellcheck">',
'<td colspan="2"><span id="fms-chb-ignore-uppercase-words"></span></td>', '<td colspan="2"><span id="fms-chb-ignore-uppercase-words"></span></td>',
'</tr>', '</tr>',
'<tr class="spellcheck">', '<tr class="spellcheck">',