Add autocorrect option: Capitalize first letter of sentence.

This commit is contained in:
Julia Radzhabova 2021-05-19 20:53:49 +03:00
parent 81b0e07330
commit c44a6d4b99
8 changed files with 52 additions and 2 deletions

View file

@ -89,3 +89,10 @@
</div> </div>
</div> </div>
</div> </div>
<div id="id-autocorrect-dialog-settings-autocorrect" class="settings-panel">
<div class="inner-content" style="width: 100%;">
<div class="padding-large">
<div id="id-autocorrect-dialog-chk-fl-sentence"></div>
</div>
</div>
</div>

View file

@ -69,6 +69,8 @@ define([ 'text!common/main/lib/template/AutoCorrectDialog.template',
else if (this.appPrefix=='sse-') else if (this.appPrefix=='sse-')
items.push({panelId: 'id-autocorrect-dialog-settings-sse-autoformat', panelCaption: this.textAutoFormat}); items.push({panelId: 'id-autocorrect-dialog-settings-sse-autoformat', panelCaption: this.textAutoFormat});
items.push({panelId: 'id-autocorrect-dialog-settings-autocorrect', panelCaption: this.textAutoCorrect});
_.extend(this.options, { _.extend(this.options, {
title: this.textTitle, title: this.textTitle,
storageName: this.appPrefix + 'autocorrect-dialog-category', storageName: this.appPrefix + 'autocorrect-dialog-category',
@ -335,9 +337,22 @@ define([ 'text!common/main/lib/template/AutoCorrectDialog.template',
}); });
} }
// AutoCorrect
this.chFLSentence = new Common.UI.CheckBox({
el: $('#id-autocorrect-dialog-chk-fl-sentence'),
labelText: this.textFLSentence,
value: Common.Utils.InternalSettings.get(this.appPrefix + "settings-autoformat-fl-sentence")
}).on('change', function(field, newValue, oldValue, eOpts){
var checked = (field.getValue()==='checked');
Common.localStorage.setBool(me.appPrefix + "settings-autoformat-fl-sentence", checked);
Common.Utils.InternalSettings.set(me.appPrefix + "settings-autoformat-fl-sentence", checked);
me.api.asc_SetAutoCorrectFirstLetterOfSentences && me.api.asc_SetAutoCorrectFirstLetterOfSentences(checked);
});
this.btnsCategory[0].on('click', _.bind(this.onMathCategoryClick, this, false)); this.btnsCategory[0].on('click', _.bind(this.onMathCategoryClick, this, false));
this.btnsCategory[1].on('click', _.bind(this.onRecCategoryClick, this, false)); this.btnsCategory[1].on('click', _.bind(this.onRecCategoryClick, this, false));
this.btnsCategory[2].on('click', _.bind(this.onAutoformatCategoryClick, this, false)); this.btnsCategory[2].on('click', _.bind(this.onAutoformatCategoryClick, this, false));
this.btnsCategory[3].on('click', _.bind(this.onAutocorrectCategoryClick, this, false));
this.afterRender(); this.afterRender();
}, },
@ -354,7 +369,8 @@ define([ 'text!common/main/lib/template/AutoCorrectDialog.template',
getFocusedComponents: function() { getFocusedComponents: function() {
var arr = [ var arr = [
this.chReplaceType, this.inputReplace, this.inputBy, this.mathList, this.btnReset, this.btnEdit, this.btnDelete, // 0 tab this.chReplaceType, this.inputReplace, this.inputBy, this.mathList, this.btnReset, this.btnEdit, this.btnDelete, // 0 tab
this.inputRecFind, this.mathRecList, this.btnResetRec, this.btnAddRec, this.btnDeleteRec // 1 tab this.inputRecFind, this.mathRecList, this.btnResetRec, this.btnAddRec, this.btnDeleteRec, // 1 tab
this.chFLSentence // 3 tab
]; ];
arr = arr.concat(this.chNewRows ? [this.chNewRows] : [this.chQuotes, this.chHyphens, this.chBulleted, this.chNumbered]); arr = arr.concat(this.chNewRows ? [this.chNewRows] : [this.chQuotes, this.chHyphens, this.chBulleted, this.chNumbered]);
return arr; return arr;
@ -399,6 +415,7 @@ define([ 'text!common/main/lib/template/AutoCorrectDialog.template',
if (value==0) this.onMathCategoryClick(true); if (value==0) this.onMathCategoryClick(true);
else if (value==1) this.onRecCategoryClick(true); else if (value==1) this.onRecCategoryClick(true);
else if (value==2) this.onAutoformatCategoryClick(true); else if (value==2) this.onAutoformatCategoryClick(true);
else if (value==3) this.onAutocorrectCategoryClick(true);
}, },
close: function() { close: function() {
@ -428,6 +445,13 @@ define([ 'text!common/main/lib/template/AutoCorrectDialog.template',
},delay ? 50 : 0); },delay ? 50 : 0);
}, },
onAutocorrectCategoryClick: function(delay) {
var me = this;
_.delay(function(){
me.chFLSentence.focus();
},delay ? 50 : 0);
},
onDelete: function() { onDelete: function() {
var rec = this.mathList.getSelectedRec(); var rec = this.mathList.getSelectedRec();
if (rec) { if (rec) {
@ -790,7 +814,9 @@ define([ 'text!common/main/lib/template/AutoCorrectDialog.template',
textBulleted: 'Automatic bulleted lists', textBulleted: 'Automatic bulleted lists',
textNumbered: 'Automatic numbered lists', textNumbered: 'Automatic numbered lists',
textApplyAsWork: 'Apply as you work', textApplyAsWork: 'Apply as you work',
textNewRowCol: 'Include new rows and columns in table' textNewRowCol: 'Include new rows and columns in table',
textAutoCorrect: 'AutoCorrect',
textFLSentence: 'Capitalize first letter of sentences'
}, Common.Views.AutoCorrectDialog || {})) }, Common.Views.AutoCorrectDialog || {}))
}); });

View file

@ -2502,6 +2502,10 @@ define([
value = Common.localStorage.getBool("de-settings-autoformat-hyphens", true); value = Common.localStorage.getBool("de-settings-autoformat-hyphens", true);
Common.Utils.InternalSettings.set("de-settings-autoformat-hyphens", value); Common.Utils.InternalSettings.set("de-settings-autoformat-hyphens", value);
me.api.asc_SetAutoCorrectHyphensWithDash(value); me.api.asc_SetAutoCorrectHyphensWithDash(value);
value = Common.localStorage.getBool("de-settings-autoformat-fl-sentence", true);
Common.Utils.InternalSettings.set("de-settings-autoformat-fl-sentence", value);
me.api.asc_SetAutoCorrectFirstLetterOfSentences(value);
}, },
showRenameUserDialog: function() { showRenameUserDialog: function() {

View file

@ -228,6 +228,8 @@
"Common.Views.AutoCorrectDialog.warnReplace": "The autocorrect entry for %1 already exists. Do you want to replace it?", "Common.Views.AutoCorrectDialog.warnReplace": "The autocorrect entry for %1 already exists. Do you want to replace it?",
"Common.Views.AutoCorrectDialog.warnReset": "Any autocorrect you added will be removed and the changed ones will be restored to their original values. Do you want to continue?", "Common.Views.AutoCorrectDialog.warnReset": "Any autocorrect you added will be removed and the changed ones will be restored to their original values. Do you want to continue?",
"Common.Views.AutoCorrectDialog.warnRestore": "The autocorrect entry for %1 will be reset to its original value. Do you want to continue?", "Common.Views.AutoCorrectDialog.warnRestore": "The autocorrect entry for %1 will be reset to its original value. Do you want to continue?",
"Common.Views.AutoCorrectDialog.textAutoCorrect": "AutoCorrect",
"Common.Views.AutoCorrectDialog.textFLSentence": "Capitalize first letter of sentences",
"Common.Views.Chat.textSend": "Send", "Common.Views.Chat.textSend": "Send",
"Common.Views.Comments.textAdd": "Add", "Common.Views.Comments.textAdd": "Add",
"Common.Views.Comments.textAddComment": "Add Comment", "Common.Views.Comments.textAddComment": "Add Comment",

View file

@ -2148,6 +2148,9 @@ define([
Common.Utils.InternalSettings.set("pe-settings-autoformat-hyphens", value); Common.Utils.InternalSettings.set("pe-settings-autoformat-hyphens", value);
me.api.asc_SetAutoCorrectHyphensWithDash(value); me.api.asc_SetAutoCorrectHyphensWithDash(value);
value = Common.localStorage.getBool("pe-settings-autoformat-fl-sentence", true);
Common.Utils.InternalSettings.set("pe-settings-autoformat-fl-sentence", value);
me.api.asc_SetAutoCorrectFirstLetterOfSentences(value);
}, },
showRenameUserDialog: function() { showRenameUserDialog: function() {

View file

@ -121,6 +121,8 @@
"Common.Views.AutoCorrectDialog.warnReplace": "The autocorrect entry for %1 already exists. Do you want to replace it?", "Common.Views.AutoCorrectDialog.warnReplace": "The autocorrect entry for %1 already exists. Do you want to replace it?",
"Common.Views.AutoCorrectDialog.warnReset": "Any autocorrect you added will be removed and the changed ones will be restored to their original values. Do you want to continue?", "Common.Views.AutoCorrectDialog.warnReset": "Any autocorrect you added will be removed and the changed ones will be restored to their original values. Do you want to continue?",
"Common.Views.AutoCorrectDialog.warnRestore": "The autocorrect entry for %1 will be reset to its original value. Do you want to continue?", "Common.Views.AutoCorrectDialog.warnRestore": "The autocorrect entry for %1 will be reset to its original value. Do you want to continue?",
"Common.Views.AutoCorrectDialog.textAutoCorrect": "AutoCorrect",
"Common.Views.AutoCorrectDialog.textFLSentence": "Capitalize first letter of sentences",
"Common.Views.Chat.textSend": "Send", "Common.Views.Chat.textSend": "Send",
"Common.Views.Comments.textAdd": "Add", "Common.Views.Comments.textAdd": "Add",
"Common.Views.Comments.textAddComment": "Add Comment", "Common.Views.Comments.textAddComment": "Add Comment",

View file

@ -2496,6 +2496,10 @@ define([
value = Common.localStorage.getBool("sse-settings-autoformat-new-rows", true); value = Common.localStorage.getBool("sse-settings-autoformat-new-rows", true);
Common.Utils.InternalSettings.set("sse-settings-autoformat-new-rows", value); Common.Utils.InternalSettings.set("sse-settings-autoformat-new-rows", value);
me.api.asc_setIncludeNewRowColTable(value); me.api.asc_setIncludeNewRowColTable(value);
value = Common.localStorage.getBool("sse-settings-autoformat-fl-sentence", true);
Common.Utils.InternalSettings.set("sse-settings-autoformat-fl-sentence", value);
me.api.asc_SetAutoCorrectFirstLetterOfSentences && me.api.asc_SetAutoCorrectFirstLetterOfSentences(value);
}, },
showRenameUserDialog: function() { showRenameUserDialog: function() {

View file

@ -169,6 +169,8 @@
"Common.Views.AutoCorrectDialog.warnReplace": "The autocorrect entry for %1 already exists. Do you want to replace it?", "Common.Views.AutoCorrectDialog.warnReplace": "The autocorrect entry for %1 already exists. Do you want to replace it?",
"Common.Views.AutoCorrectDialog.warnReset": "Any autocorrect you added will be removed and the changed ones will be restored to their original values. Do you want to continue?", "Common.Views.AutoCorrectDialog.warnReset": "Any autocorrect you added will be removed and the changed ones will be restored to their original values. Do you want to continue?",
"Common.Views.AutoCorrectDialog.warnRestore": "The autocorrect entry for %1 will be reset to its original value. Do you want to continue?", "Common.Views.AutoCorrectDialog.warnRestore": "The autocorrect entry for %1 will be reset to its original value. Do you want to continue?",
"Common.Views.AutoCorrectDialog.textAutoCorrect": "AutoCorrect",
"Common.Views.AutoCorrectDialog.textFLSentence": "Capitalize first letter of sentences",
"Common.Views.Chat.textSend": "Send", "Common.Views.Chat.textSend": "Send",
"Common.Views.Comments.textAdd": "Add", "Common.Views.Comments.textAdd": "Add",
"Common.Views.Comments.textAddComment": "Add Comment", "Common.Views.Comments.textAddComment": "Add Comment",