From c7a7ea73ab40cc7aedb65beedf7d3fcf6e2487f1 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 12 Apr 2022 11:26:54 +0200 Subject: [PATCH] fix listenning ctrl key from compile and run --- .../remix-ide/src/app/tabs/compile-and-run.ts | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/compile-and-run.ts b/apps/remix-ide/src/app/tabs/compile-and-run.ts index 7ea9308b2c..3c0bb23d9b 100644 --- a/apps/remix-ide/src/app/tabs/compile-and-run.ts +++ b/apps/remix-ide/src/app/tabs/compile-and-run.ts @@ -26,17 +26,20 @@ export class CompileAndRun extends Plugin { super(profile) this.executionListener = async (e) => { // ctrl+e or command+e - const file = await this.call('fileManager', 'file') - if ((e.metaKey || e.ctrlKey) && e.shiftKey && e.keyCode === 83 && file !== '') { - if (file.endsWith('.sol')) { - e.preventDefault() - this.targetFileName = file - await this.call('solidity', 'compile', file) - _paq.push(['trackEvent', 'ScriptExecutor', 'compile_solidity']) - } else if (file.endsWith('.js') || file.endsWith('.ts')) { - e.preventDefault() - this.runScript(file, false) - _paq.push(['trackEvent', 'ScriptExecutor', 'run_script']) + + if ((e.metaKey || e.ctrlKey) && e.shiftKey && e.keyCode === 83) { + const file = await this.call('fileManager', 'file') + if (file) { + if (file.endsWith('.sol')) { + e.preventDefault() + this.targetFileName = file + await this.call('solidity', 'compile', file) + _paq.push(['trackEvent', 'ScriptExecutor', 'compile_solidity']) + } else if (file.endsWith('.js') || file.endsWith('.ts')) { + e.preventDefault() + this.runScript(file, false) + _paq.push(['trackEvent', 'ScriptExecutor', 'run_script']) + } } } }