From a78dceb1a3da4ea3dd7de8fc0c9e41252e43b123 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 22 Jun 2022 20:35:09 +0300 Subject: [PATCH 1/2] Refactoring diagramm editor --- apps/common/main/lib/controller/ExternalDiagramEditor.js | 9 --------- apps/common/main/lib/controller/ExternalOleEditor.js | 9 --------- apps/documenteditor/main/app/controller/Toolbar.js | 6 ++---- 3 files changed, 2 insertions(+), 22 deletions(-) diff --git a/apps/common/main/lib/controller/ExternalDiagramEditor.js b/apps/common/main/lib/controller/ExternalDiagramEditor.js index 35f403ad2..70170e8ab 100644 --- a/apps/common/main/lib/controller/ExternalDiagramEditor.js +++ b/apps/common/main/lib/controller/ExternalDiagramEditor.js @@ -243,15 +243,6 @@ define([ } }, - showExternalEditor: function () { - if ( externalEditor ) { - var value = Common.localStorage.getItem("ui-theme-id", "theme-light"); - externalEditor.serviceCommand('theme:change', value); - } - - this.diagramEditorView.show(); - }, - warningTitle: 'Warning', warningText: 'The object is disabled because of editing by another user.', textClose: 'Close', diff --git a/apps/common/main/lib/controller/ExternalOleEditor.js b/apps/common/main/lib/controller/ExternalOleEditor.js index 35de11350..2b305000e 100644 --- a/apps/common/main/lib/controller/ExternalOleEditor.js +++ b/apps/common/main/lib/controller/ExternalOleEditor.js @@ -241,15 +241,6 @@ define([ } }, - showExternalEditor: function () { - if ( externalEditor ) { - var value = Common.localStorage.getItem("ui-theme-id", "theme-light"); - externalEditor.serviceCommand('theme:change', value); - } - - this.oleEditorView.show(); - }, - warningTitle: 'Warning', warningText: 'The object is disabled because of editing by another user.', textClose: 'Close', diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 5010b6dc7..0dff9909e 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -2159,14 +2159,12 @@ define([ chart.changeType(type); Common.NotificationCenter.trigger('edit:complete', this.toolbar); } else { - var controller = this.getApplication().getController('Common.Controllers.ExternalDiagramEditor'); if (!this.diagramEditor) - this.diagramEditor = controller.getView('Common.Views.ExternalDiagramEditor'); + this.diagramEditor = this.getApplication().getController('Common.Controllers.ExternalDiagramEditor').getView('Common.Views.ExternalDiagramEditor'); if (this.diagramEditor && me.api) { this.diagramEditor.setEditMode(false); - // this.diagramEditor.show(); - controller.showExternalEditor(); + this.diagramEditor.show(); chart = me.api.asc_getChartObject(type); if (chart) { From 6bd9d991eeb10184ac081f56f0b56151f23b132a Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 22 Jun 2022 21:14:44 +0300 Subject: [PATCH 2/2] Fix plugins registration --- apps/common/main/lib/controller/Plugins.js | 15 +++------------ .../forms/app/controller/Plugins.js | 15 +++------------ 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/apps/common/main/lib/controller/Plugins.js b/apps/common/main/lib/controller/Plugins.js index 9632e386e..05775c87a 100644 --- a/apps/common/main/lib/controller/Plugins.js +++ b/apps/common/main/lib/controller/Plugins.js @@ -204,17 +204,7 @@ define([ arr = []; storePlugins.each(function(item){ var plugin = new Asc.CPlugin(); - plugin.deserialize(item.attributes); - - var variations = item.get('variations'), - variationsArr = []; - variations.forEach(function(itemVar){ - var variation = new Asc.CPluginVariation(); - variation.deserialize(itemVar.attributes); - variationsArr.push(variation); - }); - - plugin.set_Variations(variationsArr); + plugin.deserialize(item.get('original')); item.set('pluginObj', plugin); arr.push(plugin); }); @@ -562,7 +552,8 @@ define([ visible: pluginVisible, groupName: (item.group) ? item.group.name : '', groupRank: (item.group) ? item.group.rank : 0, - minVersion: item.minVersion + minVersion: item.minVersion, + original: item })); } }); diff --git a/apps/documenteditor/forms/app/controller/Plugins.js b/apps/documenteditor/forms/app/controller/Plugins.js index 4e3fbdbe9..8178f6674 100644 --- a/apps/documenteditor/forms/app/controller/Plugins.js +++ b/apps/documenteditor/forms/app/controller/Plugins.js @@ -133,17 +133,7 @@ define([ arr = []; storePlugins.each(function(item){ var plugin = new Asc.CPlugin(); - plugin.deserialize(item.attributes); - - var variations = item.get('variations'), - variationsArr = []; - variations.forEach(function(itemVar){ - var variation = new Asc.CPluginVariation(); - variation.deserialize(itemVar.attributes); - variationsArr.push(variation); - }); - - plugin.set_Variations(variationsArr); + plugin.deserialize(item.get('original')); item.set('pluginObj', plugin); arr.push(plugin); }); @@ -332,7 +322,8 @@ define([ visible: pluginVisible, groupName: (item.group) ? item.group.name : '', groupRank: (item.group) ? item.group.rank : 0, - minVersion: item.minVersion + minVersion: item.minVersion, + original: item })); } });