designer keyboard shortcuts refactor

This commit is contained in:
Ezequiel Bergamaschi
2014-06-06 00:09:48 -03:00
parent 49da037936
commit 9d1ca21b67
2 changed files with 29 additions and 120 deletions

View File

@@ -21,8 +21,15 @@ mindplot.Keyboard = new Class({
initialize:function () {
},
addShortcut: function(shortcut, callback) {
$(document).bind('keydown', shortcut, callback);
addShortcut: function(shortcuts, callback) {
if (!$.isArray(shortcuts)) {
var value = shortcuts;
shortcuts = [];
shortcuts.push(value);
}
_.each(shortcuts, function(shortcut) {
$(document).bind('keydown', shortcut, callback);
});
}
});