mirror of
https://github.com/wekan/wekan.git
synced 2025-12-28 13:18:49 +01:00
Shortcut: Spacebar assigns self to current card
This commit is contained in:
parent
cd9a1094ea
commit
119d4b787d
2 changed files with 24 additions and 0 deletions
|
|
@ -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',
|
||||
}],
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue