diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index e4630cc01..108607ff9 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -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(){ diff --git a/apps/presentationeditor/main/app/view/FileMenuPanels.js b/apps/presentationeditor/main/app/view/FileMenuPanels.js index c7bd22e8e..23651deeb 100644 --- a/apps/presentationeditor/main/app/view/FileMenuPanels.js +++ b/apps/presentationeditor/main/app/view/FileMenuPanels.js @@ -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(); }, diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index dc64e7e64..9f18afaea 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -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(); diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js index 04a4ab069..ac727379f 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js @@ -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(); },