[PE] Add settings for autoformat

This commit is contained in:
Julia Radzhabova 2020-10-16 11:59:35 +03:00
parent e88d1b6518
commit fd76d435e8
3 changed files with 35 additions and 11 deletions

View file

@ -62,7 +62,7 @@ define([ 'text!common/main/lib/template/AutoCorrectDialog.template',
{panelId: 'id-autocorrect-dialog-settings-math', panelCaption: this.textMathCorrect}, {panelId: 'id-autocorrect-dialog-settings-math', panelCaption: this.textMathCorrect},
{panelId: 'id-autocorrect-dialog-settings-recognized', panelCaption: this.textRecognized} {panelId: 'id-autocorrect-dialog-settings-recognized', panelCaption: this.textRecognized}
]; ];
if (this.appPrefix=='de-') if (this.appPrefix=='de-' || this.appPrefix=='pe-')
items.push({panelId: 'id-autocorrect-dialog-settings-de-autoformat', panelCaption: this.textAutoFormat}); items.push({panelId: 'id-autocorrect-dialog-settings-de-autoformat', panelCaption: this.textAutoFormat});
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});
@ -106,28 +106,28 @@ define([ 'text!common/main/lib/template/AutoCorrectDialog.template',
value = Common.Utils.InternalSettings.get(path + "-rem"); value = Common.Utils.InternalSettings.get(path + "-rem");
this.arrRemRec = value ? JSON.parse(value) : []; this.arrRemRec = value ? JSON.parse(value) : [];
if (this.appPrefix=='de-') { if (this.appPrefix=='de-' || this.appPrefix=='pe-') {
var me = this; var me = this;
this.options.handler = function(result, value) { this.options.handler = function(result, value) {
if ( result == 'ok' ) { if ( result == 'ok' ) {
var value = me.chBulleted.getValue()==='checked'; var value = me.chBulleted.getValue()==='checked';
Common.localStorage.setBool("de-settings-autoformat-bulleted", value); Common.localStorage.setBool(this.appPrefix + "settings-autoformat-bulleted", value);
Common.Utils.InternalSettings.set("de-settings-autoformat-bulleted", value); Common.Utils.InternalSettings.set(this.appPrefix + "settings-autoformat-bulleted", value);
me.api.asc_SetAutomaticBulletedLists(value); me.api.asc_SetAutomaticBulletedLists(value);
value = me.chNumbered.getValue()==='checked'; value = me.chNumbered.getValue()==='checked';
Common.localStorage.setBool("de-settings-autoformat-numbered", value); Common.localStorage.setBool(this.appPrefix + "settings-autoformat-numbered", value);
Common.Utils.InternalSettings.set("de-settings-autoformat-numbered", value); Common.Utils.InternalSettings.set(this.appPrefix + "settings-autoformat-numbered", value);
me.api.asc_SetAutomaticNumberedLists(value); me.api.asc_SetAutomaticNumberedLists(value);
value = me.chQuotes.getValue()==='checked'; value = me.chQuotes.getValue()==='checked';
Common.localStorage.setBool("de-settings-autoformat-smart-quotes", value); Common.localStorage.setBool(this.appPrefix + "settings-autoformat-smart-quotes", value);
Common.Utils.InternalSettings.set("de-settings-autoformat-smart-quotes", value); Common.Utils.InternalSettings.set(this.appPrefix + "settings-autoformat-smart-quotes", value);
me.api.asc_SetAutoCorrectSmartQuotes(value); me.api.asc_SetAutoCorrectSmartQuotes(value);
value = me.chHyphens.getValue()==='checked'; value = me.chHyphens.getValue()==='checked';
Common.localStorage.setBool("de-settings-autoformat-hyphens", value); Common.localStorage.setBool(this.appPrefix + "settings-autoformat-hyphens", value);
Common.Utils.InternalSettings.set("de-settings-autoformat-hyphens", value); Common.Utils.InternalSettings.set(this.appPrefix + "settings-autoformat-hyphens", value);
me.api.asc_SetAutoCorrectHyphensWithDash(value); me.api.asc_SetAutoCorrectHyphensWithDash(value);
} }
}; };
@ -316,7 +316,7 @@ define([ 'text!common/main/lib/template/AutoCorrectDialog.template',
}); });
this.btnDeleteRec.on('click', _.bind(this.onDeleteRec, this, false)); this.btnDeleteRec.on('click', _.bind(this.onDeleteRec, this, false));
if (this.appPrefix=='de-') { if (this.appPrefix=='de-' || this.appPrefix=='pe-') {
this.chQuotes = new Common.UI.CheckBox({ this.chQuotes = new Common.UI.CheckBox({
el: $('#id-autocorrect-dialog-chk-quotes'), el: $('#id-autocorrect-dialog-chk-quotes'),
labelText: this.textQuotes, labelText: this.textQuotes,

View file

@ -1964,6 +1964,23 @@ define([
Common.Utils.InternalSettings.set("pe-settings-rec-functions-rem", value); Common.Utils.InternalSettings.set("pe-settings-rec-functions-rem", value);
arrRem = value ? JSON.parse(value) : []; arrRem = value ? JSON.parse(value) : [];
me.api.asc_refreshOnStartAutoCorrectMathFunctions(arrRem, arrAdd); me.api.asc_refreshOnStartAutoCorrectMathFunctions(arrRem, arrAdd);
value = Common.localStorage.getBool("pe-settings-autoformat-bulleted", true);
Common.Utils.InternalSettings.set("pe-settings-autoformat-bulleted", value);
me.api.asc_SetAutomaticBulletedLists(value);
value = Common.localStorage.getBool("pe-settings-autoformat-numbered", true);
Common.Utils.InternalSettings.set("pe-settings-autoformat-numbered", value);
me.api.asc_SetAutomaticNumberedLists(value);
value = Common.localStorage.getBool("pe-settings-autoformat-smart-quotes", true);
Common.Utils.InternalSettings.set("pe-settings-autoformat-smart-quotes", value);
me.api.asc_SetAutoCorrectSmartQuotes(value);
value = Common.localStorage.getBool("pe-settings-autoformat-hyphens", true);
Common.Utils.InternalSettings.set("pe-settings-autoformat-hyphens", value);
me.api.asc_SetAutoCorrectHyphensWithDash(value);
}, },
// Translation // Translation

View file

@ -74,6 +74,13 @@
"Common.Views.AutoCorrectDialog.textRecognizedDesc": "The following expressions are recognized math expressions. They will not be automatically italicized.", "Common.Views.AutoCorrectDialog.textRecognizedDesc": "The following expressions are recognized math expressions. They will not be automatically italicized.",
"Common.Views.AutoCorrectDialog.textWarnAddRec": "Recognized functions must contain only the letters A through Z, uppercase or lowercase.", "Common.Views.AutoCorrectDialog.textWarnAddRec": "Recognized functions must contain only the letters A through Z, uppercase or lowercase.",
"Common.Views.AutoCorrectDialog.textWarnResetRec": "Any expression you added will be removed and the removed ones will be restored. Do you want to continue?", "Common.Views.AutoCorrectDialog.textWarnResetRec": "Any expression you added will be removed and the removed ones will be restored. Do you want to continue?",
"Common.Views.AutoCorrectDialog.textAutoFormat": "AutoFormat As You Type",
"Common.Views.AutoCorrectDialog.textReplaceText": "Replace As You Type",
"Common.Views.AutoCorrectDialog.textApplyText": "Apply As You Type",
"Common.Views.AutoCorrectDialog.textQuotes": "\"Straight quotes\" with \"smart quotes\"",
"Common.Views.AutoCorrectDialog.textHyphens": "Hyphens (--) with dash (—)",
"Common.Views.AutoCorrectDialog.textBulleted": "Automatic bulleted lists",
"Common.Views.AutoCorrectDialog.textNumbered": "Automatic numbered lists",
"Common.Views.AutoCorrectDialog.textTitle": "AutoCorrect", "Common.Views.AutoCorrectDialog.textTitle": "AutoCorrect",
"Common.Views.Chat.textSend": "Send", "Common.Views.Chat.textSend": "Send",
"Common.Views.Comments.textAdd": "Add", "Common.Views.Comments.textAdd": "Add",