[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));
|
Common.Utils.InternalSettings.set("pe-settings-paste-button", parseInt(value));
|
||||||
me.api.asc_setVisiblePasteButton(!!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)
|
if (me.needToUpdateVersion)
|
||||||
Common.NotificationCenter.trigger('api:disconnect');
|
Common.NotificationCenter.trigger('api:disconnect');
|
||||||
var timer_sl = setInterval(function(){
|
var timer_sl = setInterval(function(){
|
||||||
|
|
|
@ -522,25 +522,11 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
autoCorrect: function() {
|
autoCorrect: function() {
|
||||||
if (!this._mathCorrect) {
|
if (!this._mathCorrect)
|
||||||
var arr = (this.api) ? this.api.asc_getAutoCorrectMathSymbols() : [],
|
this._mathCorrect = new Common.UI.DataViewStore();
|
||||||
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;
|
|
||||||
}
|
|
||||||
(new Common.Views.AutoCorrectDialog({
|
(new Common.Views.AutoCorrectDialog({
|
||||||
props: this._mathCorrect
|
mathStore: this._mathCorrect,
|
||||||
|
api: this.api
|
||||||
})).show();
|
})).show();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -817,6 +817,18 @@ define([
|
||||||
Common.Utils.InternalSettings.set("sse-settings-paste-button", parseInt(value));
|
Common.Utils.InternalSettings.set("sse-settings-paste-button", parseInt(value));
|
||||||
me.api.asc_setVisiblePasteButton(!!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) {
|
if (me.needToUpdateVersion) {
|
||||||
Common.NotificationCenter.trigger('api:disconnect');
|
Common.NotificationCenter.trigger('api:disconnect');
|
||||||
toolbarController.onApiCoAuthoringDisconnect();
|
toolbarController.onApiCoAuthoringDisconnect();
|
||||||
|
|
|
@ -1374,25 +1374,11 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
autoCorrect: function() {
|
autoCorrect: function() {
|
||||||
if (!this._mathCorrect) {
|
if (!this._mathCorrect)
|
||||||
var arr = (this.api) ? this.api.asc_getAutoCorrectMathSymbols() : [],
|
this._mathCorrect = new Common.UI.DataViewStore();
|
||||||
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;
|
|
||||||
}
|
|
||||||
(new Common.Views.AutoCorrectDialog({
|
(new Common.Views.AutoCorrectDialog({
|
||||||
props: this._mathCorrect
|
mathStore: this._mathCorrect,
|
||||||
|
api: this.api
|
||||||
})).show();
|
})).show();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue