- fixes import with github, http,reslver-engine

- fixes tooltip for publish to gist
- add readonly mode(is not finished yet)
pull/1/head
LianaHus 5 years ago
parent 2a010ad995
commit bc10720aeb
  1. 2
      src/app/files/file-explorer.js
  2. 15
      src/app/files/fileProvider.js
  3. 6
      src/app/ui/landing-page/landing-page.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() }
)
}

@ -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) {
@ -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)
@ -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

@ -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')
}
}
)

Loading…
Cancel
Save