Commit 371f35bb authored by LianaHus's avatar LianaHus

fixed local plugin registration

parent 5c8a313a
...@@ -315,7 +315,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org ...@@ -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 landingPage = new LandingPage(appManager, menuicons)
const sidePanel = new SidePanel(appManager, menuicons) const sidePanel = new SidePanel(appManager, menuicons)
const hiddenPanel = new HiddenPanel() const hiddenPanel = new HiddenPanel()
const pluginManagerComponent = new PluginManagerComponent(appManager) const pluginManagerComponent = new PluginManagerComponent(appManager, engine)
const filePanel = new FilePanel(appManager) const filePanel = new FilePanel(appManager)
let settings = new SettingsTab( let settings = new SettingsTab(
registry.get('config').api, registry.get('config').api,
......
...@@ -9,7 +9,6 @@ const defaultProfile = { ...@@ -9,7 +9,6 @@ const defaultProfile = {
} }
module.exports = class LocalPlugin { module.exports = class LocalPlugin {
/** /**
* Open a modal to create a local plugin * Open a modal to create a local plugin
* @param {Profile[]} plugins The list of the plugins in the store * @param {Profile[]} plugins The list of the plugins in the store
......
...@@ -72,7 +72,7 @@ const profile = { ...@@ -72,7 +72,7 @@ const profile = {
class PluginManagerComponent extends ViewPlugin { class PluginManagerComponent extends ViewPlugin {
constructor (appManager) { constructor (appManager, engine) {
super(profile) super(profile)
this.event = new EventEmitter() this.event = new EventEmitter()
this.appManager = appManager this.appManager = appManager
...@@ -85,6 +85,7 @@ class PluginManagerComponent extends ViewPlugin { ...@@ -85,6 +85,7 @@ class PluginManagerComponent extends ViewPlugin {
this.appManager.event.on('activate', () => { this.reRender() }) this.appManager.event.on('activate', () => { this.reRender() })
this.appManager.event.on('deactivate', () => { this.reRender() }) this.appManager.event.on('deactivate', () => { this.reRender() })
this.appManager.event.on('added', () => { this.reRender() }) this.appManager.event.on('added', () => { this.reRender() })
this.engine = engine
} }
isActive (name) { isActive (name) {
...@@ -149,10 +150,9 @@ class PluginManagerComponent extends ViewPlugin { ...@@ -149,10 +150,9 @@ class PluginManagerComponent extends ViewPlugin {
if (this.appManager.getIds().includes(profile.name)) { if (this.appManager.getIds().includes(profile.name)) {
throw new Error('This name has already been used') throw new Error('This name has already been used')
} }
const plugin = profile.type === 'iframe' ? new IframePlugin(profile) : new WebsocketPlugin(profile) const plugin = profile.type === 'iframe' ? new IframePlugin(profile) : new WebsocketPlugin(profile)
this.appManager.registerOne(plugin) this.engine.register(plugin)
this.appManager.activatePlugin(profile.name) this.appManager.activatePlugin(plugin.name)
} catch (err) { } catch (err) {
// TODO : Use an alert to handle this error instead of a console.log // TODO : Use an alert to handle this error instead of a console.log
console.log(`Cannot create Plugin : ${err.message}`) console.log(`Cannot create Plugin : ${err.message}`)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment