diff options
-rw-r--r-- | client/lib/keyboard.js | 23 | ||||
-rw-r--r-- | i18n/en.i18n.json | 1 |
2 files changed, 24 insertions, 0 deletions
diff --git a/client/lib/keyboard.js b/client/lib/keyboard.js index af5fb7a2..ab18d1cf 100644 --- a/client/lib/keyboard.js +++ b/client/lib/keyboard.js @@ -36,6 +36,26 @@ Mousetrap.bind(['down', 'up'], (evt, key) => { } }); +// XXX This shortcut should also work when hovering over a card in board view +Mousetrap.bind('space', (evt) => { + if (!Session.get('currentCard')) { + return; + } + + const currentUserId = Meteor.userId(); + if (currentUserId === null) { + return; + } + + if (Meteor.user().isBoardMember()) { + const card = Cards.findOne(Session.get('currentCard')); + card.toggleMember(currentUserId); + // We should prevent scrolling in card when spacebar is clicked + // This should do it according to Mousetrap docs, but it doesn't + evt.preventDefault(); + } +}); + Template.keyboardShortcuts.helpers({ mapping: [{ keys: ['W'], @@ -58,5 +78,8 @@ Template.keyboardShortcuts.helpers({ }, { keys: [':'], action: 'shortcut-autocomplete-emojies', + }, { + keys: ['SPACE'], + action: 'shortcut-assign-self', }], }); diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json index 85a0dcc5..f2298b62 100644 --- a/i18n/en.i18n.json +++ b/i18n/en.i18n.json @@ -177,6 +177,7 @@ "save": "Save", "search": "Search", "select-color": "Select a color", + "shortcut-assign-self": "Assign yourself to current card", "shortcut-autocomplete-emojies": "Autocomplete emojies", "shortcut-autocomplete-members": "Autocomplete members", "shortcut-clear-filters": "Clear all filters", |