diff --git a/apps/remix-ide/src/app/components/plugin-manager-component.js b/apps/remix-ide/src/app/components/plugin-manager-component.js index 7eddde51e5..d82001319f 100644 --- a/apps/remix-ide/src/app/components/plugin-manager-component.js +++ b/apps/remix-ide/src/app/components/plugin-manager-component.js @@ -210,8 +210,7 @@ class PluginManagerComponent extends ViewPlugin { .filter(isNotDependent) .filter(isNotHome) .sort(sortByName) - // eslint-disable-next-line no-debugger - // debugger + tempArray.forEach(profile => { if (this.appManager.actives.includes(profile.name)) { activatedPlugins.push(profile) diff --git a/libs/remix-ui/plugin-manager/src/lib/components/rootView.tsx b/libs/remix-ui/plugin-manager/src/lib/components/rootView.tsx index 83df63db2f..27eae62a4d 100644 --- a/libs/remix-ui/plugin-manager/src/lib/components/rootView.tsx +++ b/libs/remix-ui/plugin-manager/src/lib/components/rootView.tsx @@ -9,7 +9,7 @@ import PermisssionsSettings from './permissions/permissionsSettings' import { Profile } from '@remixproject/plugin-utils' const initialState: FormStateProps = { - name: 'test', + pname: 'test', displayName: 'test', url: '', type: 'iframe', @@ -68,11 +68,20 @@ function RootView ({ pluginComponent }: RootViewProps) { title="Local Plugin" okLabel="OK" okFn={() => { - const profile: any = pluginComponent.localPlugin.open(pluginComponent.appManager.getAll()) - if (pluginComponent.appManager.getIds().includes(profile.name)) { + const profile = JSON.parse(localStorage.getItem('plugins/local')) || plugin + console.log('profile from local storage looks like this', profile) + + if (!profile) return + if (pluginComponent.appManager.getIds().includes(profile.pname)) { throw new Error('This name has already been used') } + if (!profile.location) throw new Error('Plugin should have a location') + if (!profile.pname) throw new Error('Plugin should have a name') + if (!profile.url) throw new Error('Plugin should have an URL') const localPlugin = profile.type === 'iframe' ? new IframePlugin(profile) : new WebsocketPlugin(profile) + debugger + localPlugin.profile.hash = `local-${profile.pname}` + localStorage.setItem('plugins/local', JSON.stringify(localPlugin)) pluginComponent.engine.register(localPlugin) pluginComponent.appManager.activatePlugin(localPlugin.name) } } @@ -82,20 +91,48 @@ function RootView ({ pluginComponent }: RootViewProps) {