From f4611b921758eff7e86f98fc2418a9273ffaf76b Mon Sep 17 00:00:00 2001 From: nao-pon Date: Wed, 24 Aug 2016 17:16:56 +0900 Subject: [PATCH] [ui:tree] fix #1617 other volumes cmds doesn't work when it disabled in cwd --- js/commands/archive.js | 2 +- js/commands/duplicate.js | 2 +- js/commands/getfile.js | 4 ---- js/commands/rename.js | 2 +- js/commands/rm.js | 2 +- js/commands/upload.js | 4 ---- js/ui/contextmenu.js | 33 ++++++++++++++++++--------------- 7 files changed, 22 insertions(+), 27 deletions(-) diff --git a/js/commands/archive.js b/js/commands/archive.js index cb508c7624..0adc225c71 100644 --- a/js/commands/archive.js +++ b/js/commands/archive.js @@ -54,7 +54,7 @@ elFinder.prototype.commands.archive = function() { error && fm.error(error); }); - if (!(this.enabled() && cnt && mimes.length && $.inArray(mime, mimes) !== -1)) { + if (! (cnt && mimes.length && $.inArray(mime, mimes) !== -1)) { return dfrd.reject(); } diff --git a/js/commands/duplicate.js b/js/commands/duplicate.js index 8dfc4e49dc..4369b4d6c1 100644 --- a/js/commands/duplicate.js +++ b/js/commands/duplicate.js @@ -26,7 +26,7 @@ elFinder.prototype.commands.duplicate = function() { }), args = []; - if (!cnt || this.getstate(hashes) === -1) { + if (! cnt) { return dfrd.reject(); } diff --git a/js/commands/getfile.js b/js/commands/getfile.js index 8e70aa100c..084a1a06c5 100644 --- a/js/commands/getfile.js +++ b/js/commands/getfile.js @@ -69,10 +69,6 @@ req = [], i, file, dim; - if (this.getstate(hashes) == -1) { - return dfrd.reject(); - } - for (i = 0; i < cnt; i++) { file = files[i]; if (file.mime == 'directory' && !opts.folders) { diff --git a/js/commands/rename.js b/js/commands/rename.js index f90179bc12..2944da8f3d 100644 --- a/js/commands/rename.js +++ b/js/commands/rename.js @@ -210,7 +210,7 @@ elFinder.prototype.commands.rename = function() { node.empty().append(input.val(file.name)); } - if (cnt > 1 || this.getstate([file.hash]) < 0) { + if (cnt > 1) { return dfrd.reject(); } diff --git a/js/commands/rm.js b/js/commands/rm.js index bcb97c7d6f..87f6ca1e74 100644 --- a/js/commands/rm.js +++ b/js/commands/rm.js @@ -31,7 +31,7 @@ elFinder.prototype.commands.rm = function() { tpl = '
{title}
{desc}
', targets, text, f, fname, size, tmb, descs, dialog; - if (!cnt || this._disabled) { + if (! cnt) { return dfrd.reject(); } diff --git a/js/commands/upload.js b/js/commands/upload.js index 624eabf0b6..95a8d388a9 100644 --- a/js/commands/upload.js +++ b/js/commands/upload.js @@ -137,10 +137,6 @@ elFinder.prototype.commands.upload = function() { dfrd = $.Deferred(), dialog, input, button, dropbox, pastebox, dropUpload, paste, dirs, spinner; - if (this.getstate(check) < 0) { - return dfrd.reject(); - } - dropUpload = function(e) { e.stopPropagation(); e.preventDefault(); diff --git a/js/ui/contextmenu.js b/js/ui/contextmenu.js index 8a941359b7..6bf2917f40 100644 --- a/js/ui/contextmenu.js +++ b/js/ui/contextmenu.js @@ -142,23 +142,25 @@ $.fn.elfindercontextmenu = function(fm) { }, close = function() { - menu.removeAttr('style').hide().empty().removeData('submenuKeep'); - try { - if (! menu.draggable('instance')) { - menu.draggable(dragOpt); + if (menu.is(':visible') || menu.children().length) { + menu.removeAttr('style').hide().empty().removeData('submenuKeep'); + try { + if (! menu.draggable('instance')) { + menu.draggable(dragOpt); + } + } catch(e) { + if (! menu.hasClass('ui-draggable')) { + menu.draggable(dragOpt); + } } - } catch(e) { - if (! menu.hasClass('ui-draggable')) { - menu.draggable(dragOpt); + if (menu.data('prevNode')) { + menu.data('prevNode').after(menu); + menu.removeData('prevNode'); + } + fm.trigger('closecontextmenu'); + if (fm.UA.iOS) { + $('div.elfinder div.overflow-scrolling-touch').css('-webkit-overflow-scrolling', 'touch'); } - } - if (menu.data('prevNode')) { - menu.data('prevNode').after(menu); - menu.removeData('prevNode'); - } - fm.trigger('closecontextmenu'); - if (fm.UA.iOS) { - $('div.elfinder div.overflow-scrolling-touch').css('-webkit-overflow-scrolling', 'touch'); } }, @@ -280,6 +282,7 @@ $.fn.elfindercontextmenu = function(fm) { if ($.isPlainObject(opts)) { opts._currentType = type; } + close(); cmd.exec(targets, opts); } })