From e1bde7bbc21fea77df8006c706daf7b07b39f32f Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 13 Sep 2017 15:02:34 +0300 Subject: [PATCH] Autostart array of plugins. --- apps/common/main/lib/controller/Plugins.js | 11 +++++++++++ apps/documenteditor/main/app/controller/Main.js | 6 +----- apps/presentationeditor/main/app/controller/Main.js | 6 +----- apps/spreadsheeteditor/main/app/controller/Main.js | 6 +----- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/apps/common/main/lib/controller/Plugins.js b/apps/common/main/lib/controller/Plugins.js index dd57aad10..7513c4b94 100644 --- a/apps/common/main/lib/controller/Plugins.js +++ b/apps/common/main/lib/controller/Plugins.js @@ -95,6 +95,7 @@ define([ this._moveOffset = {x:0, y:0}; + this.autostart = null; }, setApi: function(api) { @@ -113,6 +114,7 @@ define([ if (mode.canPlugins) { this.updatePluginsList(); } + return this; }, onAfterRender: function(panelPlugins) { @@ -336,6 +338,7 @@ define([ else if (this.panelPlugins.iframePlugin) this.panelPlugins.closeInsideMode(); this.panelPlugins.closedPluginMode(plugin.get_Guid()); + this.runAutoStartPlugins(this.autostart); }, onPluginResize: function(size, minSize, maxSize, callback ) { @@ -372,6 +375,14 @@ define([ if (this.pluginDlg.binding.resize) this.pluginDlg.binding.resize({ pageX: x*Common.Utils.zoom()+offset.left, pageY: y*Common.Utils.zoom()+offset.top }); } else Common.NotificationCenter.trigger('frame:mousemove', { pageX: x*Common.Utils.zoom()+this._moveOffset.x, pageY: y*Common.Utils.zoom()+this._moveOffset.y }); + }, + + runAutoStartPlugins: function(autostart) { + if (autostart && autostart.length>0) { + var guid = autostart.shift(); + this.autostart = autostart; + this.api.asc_pluginRun(guid, 0, ''); + } } }, Common.Controllers.Plugins || {})); diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index b52c20798..bde6ade41 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1954,11 +1954,7 @@ define([ this.appOptions.canPlugins = false; } if (this.appOptions.canPlugins) { - this.getApplication().getController('Common.Controllers.Plugins').setMode(this.appOptions); - if (plugins.autostart && plugins.autostart.length>0) { - // run array of plugins - this.api.asc_pluginRun(plugins.autostart[0], 0, ''); - } + this.getApplication().getController('Common.Controllers.Plugins').setMode(this.appOptions).runAutoStartPlugins(plugins.autostart); } if (!uiCustomize) this.getApplication().getController('LeftMenu').enablePlugins(); }, diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index b01e61f38..fc0b0eee4 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -1729,11 +1729,7 @@ define([ this.appOptions.canPlugins = false; } if (this.appOptions.canPlugins) { - this.getApplication().getController('Common.Controllers.Plugins').setMode(this.appOptions); - if (plugins.autostart && plugins.autostart.length>0) { - // run array of plugins - this.api.asc_pluginRun(plugins.autostart[0], 0, ''); - } + this.getApplication().getController('Common.Controllers.Plugins').setMode(this.appOptions).runAutoStartPlugins(plugins.autostart); } if (!uiCustomize) this.getApplication().getController('LeftMenu').enablePlugins(); }, diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index b56afb92e..5d4683373 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -1908,11 +1908,7 @@ define([ this.appOptions.canPlugins = false; } if (this.appOptions.canPlugins) { - this.getApplication().getController('Common.Controllers.Plugins').setMode(this.appOptions); - if (plugins.autostart && plugins.autostart.length>0) { - // run array of plugins - this.api.asc_pluginRun(plugins.autostart[0], 0, ''); - } + this.getApplication().getController('Common.Controllers.Plugins').setMode(this.appOptions).runAutoStartPlugins(plugins.autostart); } if (!uiCustomize) this.getApplication().getController('LeftMenu').enablePlugins(); },