From 371f35bb102d517e7c2d3aa949aa006f5e808a3a Mon Sep 17 00:00:00 2001 From: LianaHus Date: Mon, 2 Mar 2020 14:10:45 +0100 Subject: [PATCH] fixed local plugin registration --- src/app.js | 2 +- src/app/components/local-plugin.js | 1 - src/app/components/plugin-manager-component.js | 8 ++++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/app.js b/src/app.js index d17876303d..12e7b7ec8c 100644 --- a/src/app.js +++ b/src/app.js @@ -315,7 +315,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org const landingPage = new LandingPage(appManager, menuicons) const sidePanel = new SidePanel(appManager, menuicons) const hiddenPanel = new HiddenPanel() - const pluginManagerComponent = new PluginManagerComponent(appManager) + const pluginManagerComponent = new PluginManagerComponent(appManager, engine) const filePanel = new FilePanel(appManager) let settings = new SettingsTab( registry.get('config').api, diff --git a/src/app/components/local-plugin.js b/src/app/components/local-plugin.js index 73eb282593..f71e10d7bb 100644 --- a/src/app/components/local-plugin.js +++ b/src/app/components/local-plugin.js @@ -9,7 +9,6 @@ const defaultProfile = { } module.exports = class LocalPlugin { - /** * Open a modal to create a local plugin * @param {Profile[]} plugins The list of the plugins in the store diff --git a/src/app/components/plugin-manager-component.js b/src/app/components/plugin-manager-component.js index 3260a8bccb..2b95d250e7 100644 --- a/src/app/components/plugin-manager-component.js +++ b/src/app/components/plugin-manager-component.js @@ -72,7 +72,7 @@ const profile = { class PluginManagerComponent extends ViewPlugin { - constructor (appManager) { + constructor (appManager, engine) { super(profile) this.event = new EventEmitter() this.appManager = appManager @@ -85,6 +85,7 @@ class PluginManagerComponent extends ViewPlugin { this.appManager.event.on('activate', () => { this.reRender() }) this.appManager.event.on('deactivate', () => { this.reRender() }) this.appManager.event.on('added', () => { this.reRender() }) + this.engine = engine } isActive (name) { @@ -149,10 +150,9 @@ class PluginManagerComponent extends ViewPlugin { if (this.appManager.getIds().includes(profile.name)) { throw new Error('This name has already been used') } - const plugin = profile.type === 'iframe' ? new IframePlugin(profile) : new WebsocketPlugin(profile) - this.appManager.registerOne(plugin) - this.appManager.activatePlugin(profile.name) + this.engine.register(plugin) + this.appManager.activatePlugin(plugin.name) } catch (err) { // TODO : Use an alert to handle this error instead of a console.log console.log(`Cannot create Plugin : ${err.message}`)