From cf19a8bbac67010aad8a8fb30eef8c4b6b751377 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Mon, 23 Sep 2019 17:36:08 +0200 Subject: [PATCH] - fixes import with github, http,reslver-engine - fixes tooltip for publish to gist - add readonly mode(is not finished yet) --- src/app/files/file-explorer.js | 2 +- src/app/files/fileProvider.js | 28 +++++++++++++++++++++++++ src/app/ui/landing-page/landing-page.js | 6 ++---- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src/app/files/file-explorer.js b/src/app/files/file-explorer.js index a2841a4ed4..fcb5040ebb 100644 --- a/src/app/files/file-explorer.js +++ b/src/app/files/file-explorer.js @@ -350,7 +350,7 @@ fileExplorer.prototype.init = function () { fileExplorer.prototype.publishToGist = function () { modalDialogCustom.confirm( 'Create a public gist', - 'Are you sure you want to publish all your files anonymously as a public gist on github.com?', + 'Are you sure you want to publish all your files in browser directory anonymously as a public gist on github.com?', () => { this.toGist() } ) } diff --git a/src/app/files/fileProvider.js b/src/app/files/fileProvider.js index f3096d72e9..2aef8cb3f0 100644 --- a/src/app/files/fileProvider.js +++ b/src/app/files/fileProvider.js @@ -6,6 +6,11 @@ class FileProvider { constructor (name) { this.event = new EventManager() this.type = name +<<<<<<< HEAD +======= + this.normalizedNames = {} // contains the raw url associated with the displayed path + this.readonlyItems = ['browser'] +>>>>>>> 2fe4db91... - fixes import with github, http,reslver-engine } exists (path, cb) { @@ -23,6 +28,10 @@ class FileProvider { get (path, cb) { cb = cb || function () {} +<<<<<<< HEAD +======= + if (this.normalizedNames[path]) path = this.normalizedNames[path] // ensure we actually use the normalized path from here +>>>>>>> 2fe4db91... - fixes import with github, http,reslver-engine var unprefixedpath = this.removePrefix(path) var exists = window.remixFileSystem.existsSync(unprefixedpath) if (!exists) return cb(null, null) @@ -63,15 +72,34 @@ class FileProvider { return true } +<<<<<<< HEAD addReadOnly (path, content) { +======= + addReadOnly (path, content, url) { + this.readonlyItems.push(path) + if (url !== undefined) this.normalizedNames[url] = path +>>>>>>> 2fe4db91... - fixes import with github, http,reslver-engine return this.set(path, content) } isReadOnly (path) { +<<<<<<< HEAD return false } remove (path) { +======= + return !this.readonlyItems.includes(path) + } + + remove (path) { + // remove from readonly list + const indexToRemove = this.readonlyItems.indexOf(path) + if (indexToRemove !== -1) { + this.readonlyItems.splice(indexToRemove, 1) + } + +>>>>>>> 2fe4db91... - fixes import with github, http,reslver-engine var unprefixedpath = this.removePrefix(path) if (!this._exists(unprefixedpath)) { return false diff --git a/src/app/ui/landing-page/landing-page.js b/src/app/ui/landing-page/landing-page.js index c7043935ec..c0edcbff32 100644 --- a/src/app/ui/landing-page/landing-page.js +++ b/src/app/ui/landing-page/landing-page.js @@ -110,10 +110,8 @@ export class LandingPage extends ViewPlugin { if (error) { modalDialogCustom.alert(error) } else { - if (fileProviders[type]) { - fileProviders[type].addReadOnly(cleanUrl, content, url) - globalRegistry.get('verticalicon').api.select('fileExplorers') - } + fileProviders['browser'].addReadOnly(type + '/' + cleanUrl, content, url) + globalRegistry.get('verticalicon').api.select('fileExplorers') } } )