From 67a0514567c73a437d4edc2729bb5d5f5fa03727 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 27 Mar 2023 10:11:04 +0200 Subject: [PATCH 1/4] fix adding the custom action --- libs/remix-ui/editor/src/lib/remix-ui-editor.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx index eabeb3557d..8461478de9 100644 --- a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx +++ b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx @@ -665,7 +665,7 @@ export const EditorUI = (props: EditorUIProps) => { editor.addAction(formatAction) editor.addAction(zoomOutAction) editor.addAction(zoominAction) - editor.addAction(executeFreeFunctionAction) + freeFunctionAction = editor.addAction(executeFreeFunctionAction) // we have to add the command because the menu action isn't always available (see onContextMenuHandlerForFreeFunction) editor.addCommand(monacoRef.current.KeyMod.Shift | monacoRef.current.KeyMod.Alt | monacoRef.current.KeyCode.KeyR, () => executeFreeFunctionAction.run()) @@ -673,14 +673,17 @@ export const EditorUI = (props: EditorUIProps) => { const contextmenu = editor.getContribution('editor.contrib.contextmenu') const orgContextMenuMethod = contextmenu._onContextMenu; const onContextMenuHandlerForFreeFunction = async () => { + if (freeFunctionAction) { + freeFunctionAction.dispose() + freeFunctionAction = null + } const file = await props.plugin.call('fileManager', 'getCurrentFile') if (!file.endsWith('.sol')) { freeFunctionCondition.set(false) return } const { nodesAtPosition } = await retrieveNodesAtPosition(props.editorAPI, props.plugin) - const freeFunctionNode = nodesAtPosition.find((node) => node.kind === 'freeFunction') - if (freeFunctionAction) freeFunctionAction.dispose() + const freeFunctionNode = nodesAtPosition.find((node) => node.kind === 'freeFunction') if (freeFunctionNode) { executeFreeFunctionAction.label = `Run the free function "${freeFunctionNode.name}" in the Remix VM` freeFunctionAction = editor.addAction(executeFreeFunctionAction) From 91a53c724d3ff8dab124c33b5f054e02cb905d41 Mon Sep 17 00:00:00 2001 From: lianahus Date: Fri, 24 Mar 2023 13:59:56 +0100 Subject: [PATCH 2/4] adding maintained by remix to settings and plugin manager --- apps/remix-ide/src/app/components/plugin-manager-component.js | 3 ++- apps/remix-ide/src/app/tabs/settings-tab.tsx | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) 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 0013283861..d658915f1b 100644 --- a/apps/remix-ide/src/app/components/plugin-manager-component.js +++ b/apps/remix-ide/src/app/components/plugin-manager-component.js @@ -15,7 +15,8 @@ const profile = { kind: 'settings', location: 'sidePanel', documentation: 'https://remix-ide.readthedocs.io/en/latest/plugin_manager.html', - version: packageJson.version + version: packageJson.version, + maintainedBy: "Remix" } class PluginManagerComponent extends ViewPlugin { diff --git a/apps/remix-ide/src/app/tabs/settings-tab.tsx b/apps/remix-ide/src/app/tabs/settings-tab.tsx index c92a0e423e..b68cc0f7f0 100644 --- a/apps/remix-ide/src/app/tabs/settings-tab.tsx +++ b/apps/remix-ide/src/app/tabs/settings-tab.tsx @@ -17,7 +17,8 @@ const profile = { location: 'sidePanel', documentation: 'https://remix-ide.readthedocs.io/en/latest/settings.html', version: packageJson.version, - permission: true + permission: true, + maintainedBy: "Remix" } module.exports = class SettingsTab extends ViewPlugin { From 32d9363f14030e4788be00e63848f89ea113333a Mon Sep 17 00:00:00 2001 From: lianahus Date: Fri, 24 Mar 2023 14:48:00 +0100 Subject: [PATCH 3/4] tooltips fixes --- .../src/lib/components/ActivePluginCard.tsx | 2 +- .../lib/components/permissionsSettings.tsx | 21 +++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/libs/remix-ui/plugin-manager/src/lib/components/ActivePluginCard.tsx b/libs/remix-ui/plugin-manager/src/lib/components/ActivePluginCard.tsx index 91484ff727..8290f1c8c3 100644 --- a/libs/remix-ui/plugin-manager/src/lib/components/ActivePluginCard.tsx +++ b/libs/remix-ui/plugin-manager/src/lib/components/ActivePluginCard.tsx @@ -68,7 +68,7 @@ function ActivePluginCard ({ placement="right" tooltipId={`pluginManagerInactiveActiveBtn${profile.name}`} tooltipClasses="text-nowrap" - tooltipText={`Dectivate ${profile.displayName || profile.name}`} + tooltipText={`Deactivate ${profile.displayName || profile.name}`} > + + + ) From 58eee6d5fd4f0548cfc6bd8e81d727b1af6cf487 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 27 Mar 2023 11:34:27 +0200 Subject: [PATCH 4/4] emit only if activated --- apps/remix-ide/src/blockchain/blockchain.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/remix-ide/src/blockchain/blockchain.js b/apps/remix-ide/src/blockchain/blockchain.js index d3ee2cd90b..12db0ba079 100644 --- a/apps/remix-ide/src/blockchain/blockchain.js +++ b/apps/remix-ide/src/blockchain/blockchain.js @@ -31,6 +31,7 @@ export class Blockchain extends Plugin { // NOTE: the config object will need to be refactored out in remix-lib constructor (config) { super(profile) + this.active = false this.event = new EventManager() this.executionContext = new ExecutionContext() @@ -55,11 +56,13 @@ export class Blockchain extends Plugin { } _triggerEvent (name, args) { + if (!this.active) return this.event.trigger(name, args) this.emit(name, ...args) } onActivation () { + this.active = true this.on('injected', 'chainChanged', () => { this.detectNetwork((error, network) => { this.networkStatus = { network, error } @@ -76,6 +79,7 @@ export class Blockchain extends Plugin { } onDeactivation () { + this.active = false this.off('injected', 'chainChanged') this.off('injected-trustwallet', 'chainChanged') }