From 1b3d911baad48c1c27c1f58f79504ac14a43ad9e Mon Sep 17 00:00:00 2001 From: nao-pon Date: Wed, 11 Jan 2017 17:29:21 +0900 Subject: [PATCH] [js:cmd] fix #1842 disable shortcut that specified to `disabled` --- js/elFinder.command.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js/elFinder.command.js b/js/elFinder.command.js index dc6140fd4d..eefc8bb079 100644 --- a/js/elFinder.command.js +++ b/js/elFinder.command.js @@ -121,7 +121,7 @@ elFinder.prototype.command = function(fm) { */ this.setup = function(name, opts) { var self = this, - fm = this.fm, i, s, sc; + fm = this.fm, i, s, sc, cb; this.name = name; this.title = fm.messages['cmd'+name] ? fm.i18n('cmd'+name) @@ -148,7 +148,12 @@ elFinder.prototype.command = function(fm) { for (i = 0; i < this.shortcuts.length; i++) { s = this.shortcuts[i]; - s.callback = $.proxy(s.callback || function() { this.exec() }, this); + cb = s.callback || self.exec; + s.callback = function() { + if (fm.isCommandEnabled(self.name)) { + cb.call(self); + } + }; !s.description && (s.description = this.title); fm.shortcut(s); }