From d2e8cd6b65cb8ea35ba49636e12cc1b53bfe8be6 Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 3 May 2019 14:29:00 +0200 Subject: [PATCH 1/8] usage of resolver: remove the prefix --- src/app/compiler/compiler-imports.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/app/compiler/compiler-imports.js b/src/app/compiler/compiler-imports.js index c217d32829..bd2c4fd47b 100644 --- a/src/app/compiler/compiler-imports.js +++ b/src/app/compiler/compiler-imports.js @@ -131,6 +131,9 @@ module.exports = class CompilerImports { return resolver.require(url) }) .then(result => { + if (url.indexOf(result.provider + ':') === 0) { + url = url.substring(result.provider.length + 1) // remove the github prefix + } cb(null, result.source, url, result.provider, result.url) }) .catch(err => { From cbce9748c15bd9bd930a4390fc993e1ad63bc81c Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 3 May 2019 14:29:50 +0200 Subject: [PATCH 2/8] allow compilation for file that has a suffix . e.g .sol#v1.2 --- src/app/tabs/compileTab/compileTab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/tabs/compileTab/compileTab.js b/src/app/tabs/compileTab/compileTab.js index ca5cd9ce8a..828a0e0d20 100644 --- a/src/app/tabs/compileTab/compileTab.js +++ b/src/app/tabs/compileTab/compileTab.js @@ -38,7 +38,7 @@ class CompileTab { this.editor.clearAnnotations() var currentFile = this.config.get('currentFile') if (!currentFile) return - if (!/\.sol$/.exec(currentFile)) return + if (!/\.sol/.exec(currentFile)) return // only compile *.sol file. var target = currentFile var sources = {} From 2f8253bddc0ba8e9840786d0b8075b37a81c774a Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 3 May 2019 14:30:18 +0200 Subject: [PATCH 3/8] extract extension even if it contains a suffix --- src/app/editor/editor.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/editor/editor.js b/src/app/editor/editor.js index 34d32a8a77..f447b940a7 100644 --- a/src/app/editor/editor.js +++ b/src/app/editor/editor.js @@ -218,8 +218,11 @@ class Editor { * @param {string} path Path of the file */ _getMode (path) { - let ext = path.indexOf('.') !== -1 ? /[^.]+$/.exec(path) : null - if (ext) ext = ext[0] + let ext = path.indexOf('.') !== -1 ? /[^.]+/.exec(path) : null + if (ext) ext = path.replace(ext[0] + '.', '') // we get + ext = ext.split('#') + if (!ext.length) return this.modes['txt'] + ext = ext[0] return ext && this.modes[ext] ? this.modes[ext] : this.modes['txt'] } From 854e743b2d0b3383f49cb916e43c7682d8588411 Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 3 May 2019 14:30:36 +0200 Subject: [PATCH 4/8] add example --- src/app/ui/landing-page/landing-page.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/app/ui/landing-page/landing-page.js b/src/app/ui/landing-page/landing-page.js index 583f43e365..733e79d5d0 100644 --- a/src/app/ui/landing-page/landing-page.js +++ b/src/app/ui/landing-page/landing-page.js @@ -90,10 +90,13 @@ export class LandingPage extends BaseApi { } render () { - let load = function (service, item) { + let load = function (service, item, examples) { let compilerImport = new CompilerImport() let fileProviders = globalRegistry.get('fileproviders').api - modalDialogCustom.prompt(`Import from ${service}`, 'Enter the ' + item + ' you would like to load.', null, (target) => { + const msg = yo`
Enter the ${item} you would like to load. +
e.g ${examples.map((url) => { return yo`
${url}
` })}
` + + modalDialogCustom.prompt(`Import from ${service}`, msg, null, (target) => { if (target !== '') { compilerImport.import( target, @@ -104,6 +107,7 @@ export class LandingPage extends BaseApi { } else { if (fileProviders[type]) { fileProviders[type].addReadOnly(cleanUrl, content, url) + globalRegistry.get('verticalicon').api.select('fileExplorers') } } } @@ -212,9 +216,9 @@ export class LandingPage extends BaseApi {

Import From:

- - - + + +
From 33852ebc69e03cdd17a5009ccd49d7edcfbd2d70 Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 3 May 2019 14:54:30 +0200 Subject: [PATCH 5/8] use link for example --- src/app/ui/landing-page/landing-page.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/ui/landing-page/landing-page.js b/src/app/ui/landing-page/landing-page.js index 733e79d5d0..8d7f15b760 100644 --- a/src/app/ui/landing-page/landing-page.js +++ b/src/app/ui/landing-page/landing-page.js @@ -93,8 +93,8 @@ export class LandingPage extends BaseApi { let load = function (service, item, examples) { let compilerImport = new CompilerImport() let fileProviders = globalRegistry.get('fileproviders').api - const msg = yo`
Enter the ${item} you would like to load. -
e.g ${examples.map((url) => { return yo`
${url}
` })}
` + const msg = yo`
Enter the ${item} you would like to load. +
e.g ${examples.map((url) => { return yo`` })}
` modalDialogCustom.prompt(`Import from ${service}`, msg, null, (target) => { if (target !== '') { From 831d71af504ce1d89bdd1ff9e7926c9ebe4b7480 Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 3 May 2019 14:56:04 +0200 Subject: [PATCH 6/8] splitting in 2 events: toggleContent and showContent --- src/app/components/swap-panel-api.js | 8 +++++++- src/app/components/vertical-icons-component.js | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/app/components/swap-panel-api.js b/src/app/components/swap-panel-api.js index 3fa4e742b1..e1f8c1c5e6 100644 --- a/src/app/components/swap-panel-api.js +++ b/src/app/components/swap-panel-api.js @@ -5,7 +5,7 @@ class SwapPanelApi { this.event = new EventEmmitter() this.component = swapPanelComponent this.currentContent - verticalIconsComponent.events.on('showContent', (moduleName) => { + verticalIconsComponent.events.on('toggleContent', (moduleName) => { if (!swapPanelComponent.contents[moduleName]) return if (this.currentContent === moduleName) { this.event.emit('toggle', moduleName) @@ -14,6 +14,12 @@ class SwapPanelApi { this.showContent(moduleName) this.event.emit('showing', moduleName) }) + + verticalIconsComponent.events.on('showContent', (moduleName) => { + if (!swapPanelComponent.contents[moduleName]) return + this.showContent(moduleName) + this.event.emit('showing', moduleName) + }) } showContent (moduleName) { diff --git a/src/app/components/vertical-icons-component.js b/src/app/components/vertical-icons-component.js index 4c7c8c04f2..7c3f6799d9 100644 --- a/src/app/components/vertical-icons-component.js +++ b/src/app/components/vertical-icons-component.js @@ -209,7 +209,9 @@ class VerticalIconComponent { } _iconClick (name) { - this.select(name) + this.removeActive() + this.addActive(name) + this.events.emit('toggleContent', name) } render () { From 776da949c10c9528c9325c880f36c4c7639284f5 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 6 May 2019 12:55:29 +0200 Subject: [PATCH 7/8] add more description to "import from" modal --- src/app/ui/landing-page/landing-page.js | 9 ++++++--- src/app/ui/modaldialog.js | 2 +- src/app/ui/styles/modaldialog-styles.js | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/app/ui/landing-page/landing-page.js b/src/app/ui/landing-page/landing-page.js index 8d7f15b760..2973ebadbc 100644 --- a/src/app/ui/landing-page/landing-page.js +++ b/src/app/ui/landing-page/landing-page.js @@ -90,11 +90,12 @@ export class LandingPage extends BaseApi { } render () { - let load = function (service, item, examples) { + let load = function (service, item, examples, info) { let compilerImport = new CompilerImport() let fileProviders = globalRegistry.get('fileproviders').api const msg = yo`
Enter the ${item} you would like to load. -
e.g ${examples.map((url) => { return yo`` })}
` +
${info}
+
e.g ${examples.map((url) => { return yo`` })}
` modalDialogCustom.prompt(`Import from ${service}`, msg, null, (target) => { if (target !== '') { @@ -216,9 +217,11 @@ export class LandingPage extends BaseApi {

Import From:

- + + +
diff --git a/src/app/ui/modaldialog.js b/src/app/ui/modaldialog.js index 61c644f38d..929a4875e0 100644 --- a/src/app/ui/modaldialog.js +++ b/src/app/ui/modaldialog.js @@ -135,7 +135,7 @@ function html (opts) { - +