mirror of
https://github.com/wekan/wekan.git
synced 2025-04-22 04:57:07 -04:00
More keyboard shortcuts: c for archive card
Thanks to xet7 ! Related #1878
This commit is contained in:
parent
5724674e73
commit
d16a601c04
1 changed files with 28 additions and 0 deletions
|
@ -70,6 +70,30 @@ Mousetrap.bind('space', evt => {
|
|||
}
|
||||
});
|
||||
|
||||
// XXX This shortcut should also work when hovering over a card in board view
|
||||
Mousetrap.bind('c', evt => {
|
||||
if (!Session.get('currentCard')) {
|
||||
return;
|
||||
}
|
||||
|
||||
const currentUserId = Meteor.userId();
|
||||
if (currentUserId === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
Meteor.user().isBoardMember() &&
|
||||
!Meteor.user().isCommentOnly() &&
|
||||
!Meteor.user().isWorker()
|
||||
) {
|
||||
const card = Cards.findOne(Session.get('currentCard'));
|
||||
card.archive();
|
||||
// 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: [
|
||||
{
|
||||
|
@ -104,5 +128,9 @@ Template.keyboardShortcuts.helpers({
|
|||
keys: ['SPACE'],
|
||||
action: 'shortcut-assign-self',
|
||||
},
|
||||
{
|
||||
keys: ['C'],
|
||||
action: 'archive-card',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue