added "delete from remix"

pull/5370/head
LianaHus 5 years ago
parent 4dc66e2e2d
commit ddf8d1c5dd
  1. 18
      src/app/files/file-explorer.js
  2. 9
      src/app/files/fileProvider.js

@ -220,14 +220,20 @@ function fileExplorer (localRegistry, files, menuItems) {
}
actions['Delete'] = () => {
if (self.files.readonly) { return tooltip('cannot delete file. ' + self.files.type + ' is a read only explorer') }
modalDialogCustom.confirm('Delete a file', 'Are you sure you want to delete this file?', () => { files.remove(key) }, () => {})
modalDialogCustom.confirm(
'Delete a file', 'Are you sure you want to delete this file?',
() => { files.remove(key) },
() => {}
)
}
} else {
actions['Copy to Browser explorer'] = () => {
files.get(key, (error, content) => {
if (error) return tooltip(error)
self._deps.fileManager.setFile(`browser/${label.innerText}`, content)
})
actions['Delete from remix'] = () => {
modalDialogCustom.confirm(
'Delete from remix',
'Are you sure you want to delete this file from remix?',
() => { files.remove(key) },
() => {}
)
}
}
MENU_HANDLE = contextMenu(event, actions)

@ -71,7 +71,7 @@ class FileProvider {
}
addReadOnly (path, content, url) {
this.readonlyItems.push('browser/' + path)
this.readonlyItems.push(this.type + '/' + path)
if (!url) this.normalizedNames[url] = path
return this.set(path, content)
}
@ -80,12 +80,15 @@ class FileProvider {
return this.readonlyItems.includes(path)
}
remove (path) {
// remove from readonly list
_removeFromReadonlyList (path) {
const indexToRemove = this.readonlyItems.indexOf(path)
if (indexToRemove !== -1) {
this.readonlyItems.splice(indexToRemove, 1)
}
}
remove (path) {
this._removeFromReadonlyList(path)
var unprefixedpath = this.removePrefix(path)
if (!this._exists(unprefixedpath)) {

Loading…
Cancel
Save