diff --git a/src/app/files/file-explorer.js b/src/app/files/file-explorer.js index 9982c3893a..b569d105ee 100644 --- a/src/app/files/file-explorer.js +++ b/src/app/files/file-explorer.js @@ -10,7 +10,6 @@ var Treeview = require('../ui/TreeView') var modalDialog = require('../ui/modaldialog') var EventManager = require('../../lib/events') var contextMenu = require('../ui/contextMenu') -var addTooltip = require('../ui/tooltip') var css = require('./styles/file-explorer-styles') var globalRegistry = require('../../global/registry') var queryParams = new QueryParams() @@ -63,6 +62,8 @@ function fileExplorer (localRegistry, files, menuItems) { fileManager: self._components.registry.get('filemanager').api } + self._components.registry.put({ api: self, name: `fileexplorer/${self.files.type}` }) + // warn if file changed outside of Remix function remixdDialog () { return yo`
This file has been changed outside of Remix IDE.
` @@ -175,12 +176,12 @@ function fileExplorer (localRegistry, files, menuItems) { MENU_HANDLE && MENU_HANDLE.hide(null, true) MENU_HANDLE = contextMenu(event, { 'Rename': () => { - if (self.files.readonly) { return addTooltip('cannot rename folder. ' + self.files.type + ' is a read only explorer') } + if (self.files.readonly) { return tooltip('cannot rename folder. ' + self.files.type + ' is a read only explorer') } var name = label.querySelector('label[data-path="' + key + '"]') if (name) editModeOn(name) }, 'Delete': () => { - if (self.files.readonly) { return addTooltip('cannot delete folder. ' + self.files.type + ' is a read only explorer') } + if (self.files.readonly) { return tooltip('cannot delete folder. ' + self.files.type + ' is a read only explorer') } modalDialogCustom.confirm(null, 'Do you want to delete this folder?', () => { files.remove(key) }, () => {}) } }) @@ -191,12 +192,12 @@ function fileExplorer (localRegistry, files, menuItems) { MENU_HANDLE && MENU_HANDLE.hide(null, true) MENU_HANDLE = contextMenu(event, { 'Rename': () => { - if (self.files.readonly) { return addTooltip('cannot rename file. ' + self.files.type + ' is a read only explorer') } + if (self.files.readonly) { return tooltip('cannot rename file. ' + self.files.type + ' is a read only explorer') } var name = label.querySelector('label[data-path="' + key + '"]') if (name) editModeOn(name) }, 'Delete': () => { - if (self.files.readonly) { return addTooltip('cannot delete file. ' + self.files.type + ' is a read only explorer') } + if (self.files.readonly) { return tooltip('cannot delete file. ' + self.files.type + ' is a read only explorer') } modalDialogCustom.confirm(null, 'Do you want to delete this file?', () => { files.remove(key) }, () => {}) } }) @@ -427,7 +428,7 @@ fileExplorer.prototype.packageFiles = function (filesProvider, callback) { else { async.eachSeries(Object.keys(files), (path, cb) => { filesProvider.get(path, (error, content) => { - if (/^\s+$/.test(content)) { + if (/^\s+$/.test(content) || !content.length) { content = '// this line is added to create a gist. Empty file is not allowed.' } if (error) cb(error) @@ -507,7 +508,7 @@ fileExplorer.prototype.renderMenuItems = function () { items = this.menuItems.map(({action, title, icon}) => { if (action === 'uploadFile') { return yo` -