|
|
@ -261,7 +261,10 @@ export const CompilerApiMixin = (Base) => class extends Base { |
|
|
|
|
|
|
|
|
|
|
|
this.on('fileManager', 'fileClosed', this.data.eventHandlers.onFileClosed) |
|
|
|
this.on('fileManager', 'fileClosed', this.data.eventHandlers.onFileClosed) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let postCompilationAction |
|
|
|
this.on('compilerMetadata', 'artefactsUpdated', async () => { |
|
|
|
this.on('compilerMetadata', 'artefactsUpdated', async () => { |
|
|
|
|
|
|
|
if (postCompilationAction === 69) { |
|
|
|
|
|
|
|
postCompilationAction = null |
|
|
|
if (!await this.getAppParameter('live-mode')) return |
|
|
|
if (!await this.getAppParameter('live-mode')) return |
|
|
|
const path = await this.getAppParameter('live-mode-script') |
|
|
|
const path = await this.getAppParameter('live-mode-script') |
|
|
|
if (path) { |
|
|
|
if (path) { |
|
|
@ -270,6 +273,8 @@ export const CompilerApiMixin = (Base) => class extends Base { |
|
|
|
await this.call('udapp', 'clearAllInstances') |
|
|
|
await this.call('udapp', 'clearAllInstances') |
|
|
|
this.call('scriptRunner', 'execute', content) |
|
|
|
this.call('scriptRunner', 'execute', content) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
postCompilationAction = null
|
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
this.data.eventHandlers.onCompilationFinished = async (success, data, source, input, version) => { |
|
|
|
this.data.eventHandlers.onCompilationFinished = async (success, data, source, input, version) => { |
|
|
@ -318,15 +323,14 @@ export const CompilerApiMixin = (Base) => class extends Base { |
|
|
|
this.data.eventHandlers.onKeyDown = async (e) => { |
|
|
|
this.data.eventHandlers.onKeyDown = async (e) => { |
|
|
|
if ((e.metaKey || e.ctrlKey) && e.keyCode === 83 && this.currentFile && this.currentFile.endsWith('.sol')) { |
|
|
|
if ((e.metaKey || e.ctrlKey) && e.keyCode === 83 && this.currentFile && this.currentFile.endsWith('.sol')) { |
|
|
|
// ctrl+s or command+s
|
|
|
|
// ctrl+s or command+s
|
|
|
|
|
|
|
|
postCompilationAction = e.keyCode |
|
|
|
e.preventDefault() |
|
|
|
e.preventDefault() |
|
|
|
this.compileTabLogic.runCompiler(await this.getAppParameter('hardhat-compilation')) |
|
|
|
this.compileTabLogic.runCompiler(await this.getAppParameter('hardhat-compilation')) |
|
|
|
} else if ((e.metaKey || e.ctrlKey) && e.keyCode === 69 && this.currentFile && this.currentFile.endsWith('.js')) { |
|
|
|
} else if ((e.metaKey || e.ctrlKey) && e.keyCode === 69 && this.currentFile && this.currentFile.endsWith('.sol')) { |
|
|
|
// ctrl+e or command+e
|
|
|
|
// ctrl+e or command+e
|
|
|
|
|
|
|
|
postCompilationAction = e.keyCode |
|
|
|
e.preventDefault() |
|
|
|
e.preventDefault() |
|
|
|
this.call('terminal', 'log', `running ${this.currentFile} ...`) |
|
|
|
this.compileTabLogic.runCompiler(await this.getAppParameter('hardhat-compilation')) |
|
|
|
const content = await this.call('fileManager', 'readFile', this.currentFile) |
|
|
|
|
|
|
|
await this.call('udapp', 'clearAllInstances') |
|
|
|
|
|
|
|
this.call('scriptRunner', 'execute', content) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
window.document.addEventListener('keydown', this.data.eventHandlers.onKeyDown) |
|
|
|
window.document.addEventListener('keydown', this.data.eventHandlers.onKeyDown) |
|
|
|