Merge pull request #1943 from ethereum/showCompilerError

Switch to file when clicking on the compiler error && update behavior when displaying context menu for read only explorer
pull/1/head
yann300 6 years ago committed by GitHub
commit d3f1322eed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      src/app/files/file-explorer.js
  2. 6
      src/app/files/fileManager.js
  3. 2
      src/app/panels/editor-panel.js
  4. 1
      src/app/ui/contextMenu.js

@ -172,6 +172,7 @@ function fileExplorer (localRegistry, files, menuItems) {
}) })
self.treeView.event.register('nodeRightClick', function (key, data, label, event) { self.treeView.event.register('nodeRightClick', function (key, data, label, event) {
if (self.files.readonly) return
if (key === self.files.type) return if (key === self.files.type) return
MENU_HANDLE && MENU_HANDLE.hide(null, true) MENU_HANDLE && MENU_HANDLE.hide(null, true)
MENU_HANDLE = contextMenu(event, { MENU_HANDLE = contextMenu(event, {
@ -190,17 +191,27 @@ function fileExplorer (localRegistry, files, menuItems) {
self.treeView.event.register('leafRightClick', function (key, data, label, event) { self.treeView.event.register('leafRightClick', function (key, data, label, event) {
if (key === self.files.type) return if (key === self.files.type) return
MENU_HANDLE && MENU_HANDLE.hide(null, true) MENU_HANDLE && MENU_HANDLE.hide(null, true)
MENU_HANDLE = contextMenu(event, { let actions = {}
'Rename': () => { if (!self.files.readonly) {
actions['Rename'] = () => {
if (self.files.readonly) { return tooltip('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 + '"]') var name = label.querySelector('label[data-path="' + key + '"]')
if (name) editModeOn(name) if (name) editModeOn(name)
}, }
'Delete': () => { actions['Delete'] = () => {
if (self.files.readonly) { return tooltip('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('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) }, () => {})
} }
}
if (self.files.type !== 'browser') {
actions['Copy to Browser explorer'] = () => {
files.get(key, (error, content) => {
if (error) return tooltip(error)
self._deps.fileManager.setFile(`browser/${label.innerText}`, content)
}) })
}
}
MENU_HANDLE = contextMenu(event, actions)
}) })
self.treeView.event.register('leafClick', function (key, data, label) { self.treeView.event.register('leafClick', function (key, data, label) {

@ -189,6 +189,12 @@ class FileManager extends FileSystemApi {
this.switchFile() this.switchFile()
} }
unselectCurrentFile () {
this.saveCurrentFile()
this._deps.config.set('currentFile', '')
this.events.emit('noFileSelected')
}
switchFile (file) { switchFile (file) {
const _switchFile = (file) => { const _switchFile = (file) => {
this.saveCurrentFile() this.saveCurrentFile()

@ -51,11 +51,11 @@ class EditorPanel {
} }
self.tabProxy = new TabProxy(self._deps.fileManager, self._components.editor, self.appStore, self.appManager) self.tabProxy = new TabProxy(self._deps.fileManager, self._components.editor, self.appStore, self.appManager)
let showApp = function (name) { let showApp = function (name) {
self._deps.fileManager.unselectCurrentFile()
self.mainPanelComponent.showContent(name) self.mainPanelComponent.showContent(name)
self._view.editor.style.display = 'none' self._view.editor.style.display = 'none'
self._components.contextView.hide() self._components.contextView.hide()
self._view.mainPanel.style.display = 'block' self._view.mainPanel.style.display = 'block'
self.tabProxy.sh
} }
self.appManager.event.on('ensureActivated', (name) => { self.appManager.event.on('ensureActivated', (name) => {
if (name === 'home') { if (name === 'home') {

@ -7,7 +7,6 @@ var css = csjs`
{ {
display: none; display: none;
position: fixed; position: fixed;
width:100px;
border-radius: 2px; border-radius: 2px;
z-index: 1000; z-index: 1000;
box-shadow: 0 0 4px var(--dark); box-shadow: 0 0 4px var(--dark);

Loading…
Cancel
Save