Skip to content

Commit

Permalink
[js:cmd] fix #1842 disable shortcut that specified to disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
nao-pon committed Jan 11, 2017
1 parent eae6a6c commit 1b3d911
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions js/elFinder.command.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
}
Expand Down

0 comments on commit 1b3d911

Please sign in to comment.