new plugins scheme (system & parallel working)

This commit is contained in:
Oleg Korshul 2017-10-17 18:08:12 +03:00
parent 1f8766ce68
commit c8a12f7dba
2 changed files with 7 additions and 5 deletions

View file

@ -277,14 +277,14 @@ define([
this.api.asc_pluginRun(record.get('guid'), 0, ''); this.api.asc_pluginRun(record.get('guid'), 0, '');
}, },
onPluginShow: function(plugin, variationIndex) { onPluginShow: function(plugin, variationIndex, frameId) {
var variation = plugin.get_Variations()[variationIndex]; var variation = plugin.get_Variations()[variationIndex];
if (variation.get_Visual()) { if (variation.get_Visual()) {
var url = variation.get_Url(); var url = variation.get_Url();
url = ((plugin.get_BaseUrl().length == 0) ? url : plugin.get_BaseUrl()) + url; url = ((plugin.get_BaseUrl().length == 0) ? url : plugin.get_BaseUrl()) + url;
if (variation.get_InsideMode()) { if (variation.get_InsideMode()) {
if (!this.panelPlugins.openInsideMode(plugin.get_Name(), url)) if (!this.panelPlugins.openInsideMode(plugin.get_Name(), url, frameId))
this.api.asc_pluginButtonClick(-1); this.api.asc_pluginButtonClick(-1);
} else { } else {
var me = this, var me = this,
@ -307,6 +307,7 @@ define([
width: size[0], // inner width width: size[0], // inner width
height: size[1], // inner height height: size[1], // inner height
url: url, url: url,
frameId : frameId,
buttons: isCustomWindow ? undefined : newBtns, buttons: isCustomWindow ? undefined : newBtns,
toolcallback: _.bind(this.onToolClose, this) toolcallback: _.bind(this.onToolClose, this)
}); });

View file

@ -194,7 +194,7 @@ define([
} }
}, },
openInsideMode: function(name, url) { openInsideMode: function(name, url, frameId) {
if (!this.pluginsPanel) return false; if (!this.pluginsPanel) return false;
this.pluginsPanel.toggleClass('hidden', true); this.pluginsPanel.toggleClass('hidden', true);
@ -203,7 +203,7 @@ define([
this.pluginName.text(name); this.pluginName.text(name);
if (!this.iframePlugin) { if (!this.iframePlugin) {
this.iframePlugin = document.createElement("iframe"); this.iframePlugin = document.createElement("iframe");
this.iframePlugin.id = 'plugin_iframe'; this.iframePlugin.id = (frameId === undefined) ? 'plugin_iframe' : frameId;
this.iframePlugin.name = 'pluginFrameEditor'; this.iframePlugin.name = 'pluginFrameEditor';
this.iframePlugin.width = '100%'; this.iframePlugin.width = '100%';
this.iframePlugin.height = '100%'; this.iframePlugin.height = '100%';
@ -372,6 +372,7 @@ define([
_options.tpl = _.template(this.template)(_options); _options.tpl = _.template(this.template)(_options);
this.url = options.url || ''; this.url = options.url || '';
this.frameId = options.frameId || 'plugin_iframe';
Common.UI.Window.prototype.initialize.call(this, _options); Common.UI.Window.prototype.initialize.call(this, _options);
}, },
@ -385,7 +386,7 @@ define([
this._headerFooterHeight += ((parseInt(this.$window.css('border-top-width')) + parseInt(this.$window.css('border-bottom-width')))); this._headerFooterHeight += ((parseInt(this.$window.css('border-top-width')) + parseInt(this.$window.css('border-bottom-width'))));
var iframe = document.createElement("iframe"); var iframe = document.createElement("iframe");
iframe.id = 'plugin_iframe'; iframe.id = this.frameId;
iframe.name = 'pluginFrameEditor'; iframe.name = 'pluginFrameEditor';
iframe.width = '100%'; iframe.width = '100%';
iframe.height = '100%'; iframe.height = '100%';