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 => { 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 () { 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'] } 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 = {} diff --git a/src/app/ui/landing-page/landing-page.js b/src/app/ui/landing-page/landing-page.js index 583f43e365..2973ebadbc 100644 --- a/src/app/ui/landing-page/landing-page.js +++ b/src/app/ui/landing-page/landing-page.js @@ -90,10 +90,14 @@ export class LandingPage extends BaseApi { } render () { - let load = function (service, item) { + let load = function (service, item, examples, info) { 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. +
${info}
+
e.g ${examples.map((url) => { return yo`` })}
` + + modalDialogCustom.prompt(`Import from ${service}`, msg, null, (target) => { if (target !== '') { compilerImport.import( target, @@ -104,6 +108,7 @@ export class LandingPage extends BaseApi { } else { if (fileProviders[type]) { fileProviders[type].addReadOnly(cleanUrl, content, url) + globalRegistry.get('verticalicon').api.select('fileExplorers') } } } @@ -212,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) { - +