Skip to content

Commit

Permalink
- fixes import with github, http,reslver-engine
Browse files Browse the repository at this point in the history
- fixes tooltip for publish to gist
- add readonly mode(is not finished yet)
  • Loading branch information
LianaHus committed Sep 24, 2019
1 parent 2a010ad commit bc10720
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/app/files/file-explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() }
)
}
Expand Down
15 changes: 13 additions & 2 deletions src/app/files/fileProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ class FileProvider {
constructor (name) {
this.event = new EventManager()
this.type = name
this.normalizedNames = {} // contains the raw url associated with the displayed path
this.readonlyItems = ['browser']
}

exists (path, cb) {
Expand All @@ -23,6 +25,7 @@ class FileProvider {

get (path, cb) {
cb = cb || function () {}
if (this.normalizedNames[path]) path = this.normalizedNames[path] // ensure we actually use the normalized path from here
var unprefixedpath = this.removePrefix(path)
var exists = window.remixFileSystem.existsSync(unprefixedpath)
if (!exists) return cb(null, null)
Expand Down Expand Up @@ -63,15 +66,23 @@ class FileProvider {
return true
}

addReadOnly (path, content) {
addReadOnly (path, content, url) {
this.readonlyItems.push(path)
if (url !== undefined) this.normalizedNames[url] = path
return this.set(path, content)
}

isReadOnly (path) {
return false
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)
}

var unprefixedpath = this.removePrefix(path)
if (!this._exists(unprefixedpath)) {
return false
Expand Down
6 changes: 2 additions & 4 deletions src/app/ui/landing-page/landing-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
}
)
Expand Down

0 comments on commit bc10720

Please sign in to comment.