diff --git a/src/app/panels/righthand-panel.js b/src/app/panels/righthand-panel.js index 0be20ce6f8..a6cdc458fc 100644 --- a/src/app/panels/righthand-panel.js +++ b/src/app/panels/righthand-panel.js @@ -83,7 +83,7 @@ module.exports = class RighthandPanel { }) var tab = new PluginTab(json) var content = tab.render() - document.querySelector('body').appendChild(modal.render(json.title, content)) + document.querySelector('body').appendChild(modal.render(json.title, json.url, content)) self._components.pluginManager.register(json, modal, content) } diff --git a/src/app/plugin/pluginAPI.js b/src/app/plugin/pluginAPI.js index 74ac773bae..91ecba552e 100644 --- a/src/app/plugin/pluginAPI.js +++ b/src/app/plugin/pluginAPI.js @@ -5,7 +5,7 @@ var SourceHighlighter = require('../editor/sourceHighlighter') Defines available API. `key` / `type` */ module.exports = (pluginManager, fileProviders, fileManager, compiler, udapp) => { - var highlighter = new SourceHighlighter() + let highlighters = {} return { app: { getExecutionContextProvider: (mod, cb) => { @@ -136,12 +136,13 @@ module.exports = (pluginManager, fileProviders, fileManager, compiler, udapp) => } catch (e) { return cb(e.message) } - highlighter.currentSourceLocation(null) - highlighter.currentSourceLocationFromfileName(position, filePath, hexColor) + if (!highlighters[mod]) highlighters[mod] = new SourceHighlighter() + highlighters[mod].currentSourceLocation(null) + highlighters[mod].currentSourceLocationFromfileName(position, filePath, hexColor) cb() }, discardHighlight: (mod, cb) => { - highlighter.currentSourceLocation(null) + if (highlighters[mod]) highlighters[mod].currentSourceLocation(null) cb() } } diff --git a/src/app/plugin/pluginManager.js b/src/app/plugin/pluginManager.js index 1b0012af25..e8ad1eff9f 100644 --- a/src/app/plugin/pluginManager.js +++ b/src/app/plugin/pluginManager.js @@ -90,6 +90,7 @@ module.exports = class PluginManager { compiler, udapp ) + self._components = { pluginAPI } self.plugins = {} self.origins = {} self.inFocus @@ -181,6 +182,7 @@ module.exports = class PluginManager { } unregister (desc) { const self = this + self._components.pluginAPI.editor.discardHighlight(desc.title, () => {}) delete self.plugins[desc.title] delete self.origins[desc.url] } diff --git a/src/app/tabs/settings-tab.js b/src/app/tabs/settings-tab.js index 0053a2c205..85c31c7ef1 100644 --- a/src/app/tabs/settings-tab.js +++ b/src/app/tabs/settings-tab.js @@ -136,14 +136,15 @@ module.exports = class SettingsTab { function loadPlugins (plugins, opt) { for (var k in plugins) { - var plugin = plugins[k] - if (!self._view.plugins[plugin.title]) self._view.plugins[plugin.title] = {} - self._view.plugins[plugin.title].json = plugin - self._view.plugins[plugin.title].el = yo`