This commit is contained in:
Alexei Koshelev 2022-11-19 06:02:19 +03:00
parent e81c8dedb8
commit a13d01897b

View file

@ -487,22 +487,30 @@ define([ 'text!common/main/lib/template/AutoCorrectDialog.template',
onDelete: function() {
var rec = this.mathList.getSelectedRec();
var path = '';
var val;
if (rec) {
if (rec.get('defaultValue')) {
var path = this.appPrefix + "settings-math-correct-rem";
path = this.appPrefix + "settings-math-correct-rem";
var disabled = !rec.get('defaultDisabled');
rec.set('defaultDisabled', disabled);
if (disabled)
this.arrRem.push(rec.get('replaced'));
else
this.arrRem.splice(this.arrRem.indexOf(rec.get('replaced')), 1);
var val = JSON.stringify(this.arrRem);
val = JSON.stringify(this.arrRem);
Common.Utils.InternalSettings.set(path, val);
Common.localStorage.setItem(path, val);
this.btnDelete.setCaption(disabled ? this.textRestore : this.textDelete);
disabled ? this.api.asc_deleteFromAutoCorrectMathSymbols(rec.get('replaced')) : this.api.asc_AddOrEditFromAutoCorrectMathSymbols(rec.get('replaced'), rec.get('defaultValue'));
} else {
_mathStore.remove(rec);
this.arrAdd.splice(this.arrAdd.indexOf(rec.get('replaced')), 1);
path = this.appPrefix + "settings-math-correct-add";
val = JSON.stringify(this.arrAdd);
Common.Utils.InternalSettings.set(path, val);
Common.localStorage.setItem(path, val);
this.mathList.scroller && this.mathList.scroller.update({});
this.api.asc_deleteFromAutoCorrectMathSymbols(rec.get('replaced'));
}
@ -746,22 +754,30 @@ define([ 'text!common/main/lib/template/AutoCorrectDialog.template',
onDeleteRec: function() {
var rec = this.mathRecList.getSelectedRec();
var path;
var val;
if (rec) {
if (rec.get('defaultValue')) {
var path = this.appPrefix + "settings-rec-functions-rem";
path = this.appPrefix + "settings-rec-functions-rem";
var disabled = !rec.get('defaultDisabled');
rec.set('defaultDisabled', disabled);
if (disabled)
this.arrRemRec.push(rec.get('value'));
else
this.arrRemRec.splice(this.arrRemRec.indexOf(rec.get('value')), 1);
var val = JSON.stringify(this.arrRemRec);
val = JSON.stringify(this.arrRemRec);
Common.Utils.InternalSettings.set(path, val);
Common.localStorage.setItem(path, val);
this.btnDeleteRec.setCaption(disabled ? this.textRestore : this.textDelete);
disabled ? this.api.asc_deleteFromAutoCorrectMathFunctions(rec.get('value')) : this.api.asc_AddFromAutoCorrectMathFunctions(rec.get('value'));
} else {
_functionsStore.remove(rec);
this.arrAddRec.splice(this.arrAddRec.indexOf(rec.get('value')), 1);
path = this.appPrefix + "settings-rec-functions-add";
val = JSON.stringify(this.arrAddRec);
Common.Utils.InternalSettings.set(path, val);
Common.localStorage.setItem(path, val);
this.mathRecList.scroller && this.mathRecList.scroller.update({});
this.api.asc_deleteFromAutoCorrectMathFunctions(rec.get('value'));
}