[DE] Add option for autocorrection mode

This commit is contained in:
Julia Radzhabova 2020-07-24 16:16:41 +03:00
parent 41466def0c
commit 58d61f4d87
2 changed files with 24 additions and 5 deletions

View file

@ -65,10 +65,15 @@ define([
'<div id="symbol-table-pnl-special">', '<div id="symbol-table-pnl-special">',
'<table cols="1" style="width: 100%;">', '<table cols="1" style="width: 100%;">',
'<tr>', '<tr>',
'<td style="padding-bottom: 8px;">', '<td style="padding-bottom: 16px;">',
'<label style="font-weight: bold;">' + this.textMathCorrect + '</label>', '<label style="font-weight: bold;">' + this.textMathCorrect + '</label>',
'</td>', '</td>',
'</tr>', '</tr>',
'<tr>',
'<td style="padding-bottom: 8px;">',
'<div id="auto-correct-chb-replace-type"></div>',
'</td>',
'</tr>',
'<tr>', '<tr>',
'<td>', '<td>',
'<label style="width: 117px;">' + this.textReplace + '</label>', '<label style="width: 117px;">' + this.textReplace + '</label>',
@ -87,7 +92,7 @@ define([
'</td>', '</td>',
'</tr>', '</tr>',
'<tr>', '<tr>',
'<td style="padding-bottom: 16px;">', '<td style="padding-bottom: 8px;">',
'<button type="button" class="btn btn-text-default auto" id="auto-correct-btn-reset" style="min-width: 100px;">' + this.textResetAll + '</button>', '<button type="button" class="btn btn-text-default auto" id="auto-correct-btn-reset" style="min-width: 100px;">' + this.textResetAll + '</button>',
'<button type="button" class="btn btn-text-default auto" id="auto-correct-btn-delete" style="min-width: 100px;float: right;">' + this.textDelete + '</button>', '<button type="button" class="btn btn-text-default auto" id="auto-correct-btn-delete" style="min-width: 100px;float: right;">' + this.textDelete + '</button>',
'<button type="button" class="btn btn-text-default auto" id="auto-correct-btn-edit" style="min-width: 100px;float: right;margin-right:5px;">' + this.textAdd+ '</button>', '<button type="button" class="btn btn-text-default auto" id="auto-correct-btn-edit" style="min-width: 100px;float: right;margin-right:5px;">' + this.textAdd+ '</button>',
@ -96,7 +101,6 @@ define([
'</table>', '</table>',
'</div>', '</div>',
'</div>', '</div>',
'<div class="separator"></div>',
'<div class="footer center">', '<div class="footer center">',
'<button class="btn normal dlg-btn" result="cancel" style="width: 86px;">' + this.closeButtonText + '</button>', '<button class="btn normal dlg-btn" result="cancel" style="width: 86px;">' + this.closeButtonText + '</button>',
'</div>' '</div>'
@ -121,6 +125,17 @@ define([
var $window = this.getChild(); var $window = this.getChild();
var me = this; var me = this;
this.chReplaceType = new Common.UI.CheckBox({
el: $window.findById('#auto-correct-chb-replace-type'),
labelText: this.textReplaceType,
value: Common.Utils.InternalSettings.get(this.appPrefix + "settings-math-correct-replace-type")
}).on('change', function(field, newValue, oldValue, eOpts){
var checked = (field.getValue()==='checked');
Common.localStorage.setBool(me.appPrefix + "settings-math-correct-replace-type", checked);
Common.Utils.InternalSettings.set(me.appPrefix + "settings-math-correct-replace-type", checked);
me.api.asc_updateFlagAutoCorrectMathSymbols(checked);
});
this.onInitList(); this.onInitList();
// special // special
@ -408,7 +423,8 @@ define([
textEdit: 'Replace', textEdit: 'Replace',
textDelete: 'Delete', textDelete: 'Delete',
textRestore: 'Restore', textRestore: 'Restore',
textReset: 'Reset' textReset: 'Reset',
textReplaceType: 'Replace text as you type'
}, Common.Views.AutoCorrectDialog || {})) }, Common.Views.AutoCorrectDialog || {}))
}); });

View file

@ -1061,7 +1061,10 @@ define([
value = Common.localStorage.getItem("de-settings-math-correct-rem"); value = Common.localStorage.getItem("de-settings-math-correct-rem");
Common.Utils.InternalSettings.set("de-settings-math-correct-rem", value); Common.Utils.InternalSettings.set("de-settings-math-correct-rem", value);
var arrRem = value ? JSON.parse(value) : []; var arrRem = value ? JSON.parse(value) : [];
me.api.asc_refreshOnStartAutoCorrectMathSymbols(arrRem, arrAdd, true); value = Common.localStorage.getBool("de-settings-math-correct-replace-type", true); // replace on type
Common.Utils.InternalSettings.set("de-settings-math-correct-replace-type", value);
me.api.asc_refreshOnStartAutoCorrectMathSymbols(arrRem, arrAdd, value);
if (me.needToUpdateVersion) if (me.needToUpdateVersion)
Common.NotificationCenter.trigger('api:disconnect'); Common.NotificationCenter.trigger('api:disconnect');