diff --git a/src/app/files/file-explorer.js b/src/app/files/file-explorer.js index 27164ca7a9..9ed63ca39a 100644 --- a/src/app/files/file-explorer.js +++ b/src/app/files/file-explorer.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) diff --git a/src/app/files/fileProvider.js b/src/app/files/fileProvider.js index b9d6b27411..21c5c679e2 100644 --- a/src/app/files/fileProvider.js +++ b/src/app/files/fileProvider.js @@ -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)) {