Merge pull request #1202 from bitpshr/feature/context-menu-close

Show one context menu at a time
pull/3094/head
yann300 7 years ago committed by GitHub
commit 7dbbbf56b3
  1. 8
      src/app/files/file-explorer.js
  2. 2
      src/app/ui/contextMenu.js

@ -10,6 +10,8 @@ var helper = require('../../lib/helper')
var css = require('./styles/file-explorer-styles')
let MENU_HANDLE
function fileExplorer (appAPI, files) {
var self = this
this.events = new EventManager()
@ -119,7 +121,8 @@ function fileExplorer (appAPI, files) {
})
self.treeView.event.register('nodeRightClick', function (key, data, label, event) {
contextMenu(event, {
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') }
var name = label.querySelector('label[data-path="' + key + '"]')
@ -133,7 +136,8 @@ function fileExplorer (appAPI, files) {
})
self.treeView.event.register('leafRightClick', function (key, data, label, event) {
contextMenu(event, {
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') }
var name = label.querySelector('label[data-path="' + key + '"]')

@ -65,4 +65,6 @@ module.exports = (event, items) => {
setTimeout(() => {
window.addEventListener('click', hide)
}, 500)
return { hide }
}

Loading…
Cancel
Save