[SSE][PE] Add autocorrect editing
This commit is contained in:
parent
5785527607
commit
b09dfcdf53
|
@ -780,6 +780,18 @@ define([
|
|||
Common.Utils.InternalSettings.set("pe-settings-paste-button", parseInt(value));
|
||||
me.api.asc_setVisiblePasteButton(!!parseInt(value));
|
||||
|
||||
// autocorrection
|
||||
value = Common.localStorage.getItem("pe-settings-math-correct-add");
|
||||
Common.Utils.InternalSettings.set("pe-settings-math-correct-add", value);
|
||||
var arrAdd = value ? JSON.parse(value) : [];
|
||||
value = Common.localStorage.getItem("pe-settings-math-correct-rem");
|
||||
Common.Utils.InternalSettings.set("pe-settings-math-correct-rem", value);
|
||||
var arrRem = value ? JSON.parse(value) : [];
|
||||
value = Common.localStorage.getBool("pe-settings-math-correct-replace-type", true); // replace on type
|
||||
Common.Utils.InternalSettings.set("pe-settings-math-correct-replace-type", value);
|
||||
|
||||
me.api.asc_refreshOnStartAutoCorrectMathSymbols(arrRem, arrAdd, value);
|
||||
|
||||
if (me.needToUpdateVersion)
|
||||
Common.NotificationCenter.trigger('api:disconnect');
|
||||
var timer_sl = setInterval(function(){
|
||||
|
|
|
@ -522,25 +522,11 @@ define([
|
|||
},
|
||||
|
||||
autoCorrect: function() {
|
||||
if (!this._mathCorrect) {
|
||||
var arr = (this.api) ? this.api.asc_getAutoCorrectMathSymbols() : [],
|
||||
data = [];
|
||||
_.each(arr, function(item, index){
|
||||
var itm = {replaced: item[0]};
|
||||
if (typeof item[1]=='object') {
|
||||
itm.by = '';
|
||||
_.each(item[1], function(ch){
|
||||
itm.by += Common.Utils.String.encodeSurrogateChar(ch);
|
||||
});
|
||||
} else {
|
||||
itm.by = Common.Utils.String.encodeSurrogateChar(item[1]);
|
||||
}
|
||||
data.push(itm);
|
||||
});
|
||||
this._mathCorrect = data;
|
||||
}
|
||||
if (!this._mathCorrect)
|
||||
this._mathCorrect = new Common.UI.DataViewStore();
|
||||
(new Common.Views.AutoCorrectDialog({
|
||||
props: this._mathCorrect
|
||||
mathStore: this._mathCorrect,
|
||||
api: this.api
|
||||
})).show();
|
||||
},
|
||||
|
||||
|
|
|
@ -817,6 +817,18 @@ define([
|
|||
Common.Utils.InternalSettings.set("sse-settings-paste-button", parseInt(value));
|
||||
me.api.asc_setVisiblePasteButton(!!parseInt(value));
|
||||
|
||||
// autocorrection
|
||||
value = Common.localStorage.getItem("sse-settings-math-correct-add");
|
||||
Common.Utils.InternalSettings.set("sse-settings-math-correct-add", value);
|
||||
var arrAdd = value ? JSON.parse(value) : [];
|
||||
value = Common.localStorage.getItem("sse-settings-math-correct-rem");
|
||||
Common.Utils.InternalSettings.set("sse-settings-math-correct-rem", value);
|
||||
var arrRem = value ? JSON.parse(value) : [];
|
||||
value = Common.localStorage.getBool("sse-settings-math-correct-replace-type", true); // replace on type
|
||||
Common.Utils.InternalSettings.set("sse-settings-math-correct-replace-type", value);
|
||||
|
||||
me.api.asc_refreshOnStartAutoCorrectMathSymbols(arrRem, arrAdd, value);
|
||||
|
||||
if (me.needToUpdateVersion) {
|
||||
Common.NotificationCenter.trigger('api:disconnect');
|
||||
toolbarController.onApiCoAuthoringDisconnect();
|
||||
|
|
|
@ -1374,25 +1374,11 @@ define([
|
|||
},
|
||||
|
||||
autoCorrect: function() {
|
||||
if (!this._mathCorrect) {
|
||||
var arr = (this.api) ? this.api.asc_getAutoCorrectMathSymbols() : [],
|
||||
data = [];
|
||||
_.each(arr, function(item, index){
|
||||
var itm = {replaced: item[0]};
|
||||
if (typeof item[1]=='object') {
|
||||
itm.by = '';
|
||||
_.each(item[1], function(ch){
|
||||
itm.by += Common.Utils.String.encodeSurrogateChar(ch);
|
||||
});
|
||||
} else {
|
||||
itm.by = Common.Utils.String.encodeSurrogateChar(item[1]);
|
||||
}
|
||||
data.push(itm);
|
||||
});
|
||||
this._mathCorrect = data;
|
||||
}
|
||||
if (!this._mathCorrect)
|
||||
this._mathCorrect = new Common.UI.DataViewStore();
|
||||
(new Common.Views.AutoCorrectDialog({
|
||||
props: this._mathCorrect
|
||||
mathStore: this._mathCorrect,
|
||||
api: this.api
|
||||
})).show();
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue