mirror of
https://github.com/wekan/wekan.git
synced 2025-04-23 13:37:09 -04:00
Add additional archiving keyboard shortcut
This commit is contained in:
parent
b29c19f5e0
commit
503298a33f
1 changed files with 8 additions and 22 deletions
|
@ -219,7 +219,7 @@ Mousetrap.bind('space', evt => {
|
|||
}
|
||||
});
|
||||
|
||||
Mousetrap.bind('c', evt => {
|
||||
const archiveCard = evt => {
|
||||
const cardId = getSelectedCardId();
|
||||
if (!cardId) {
|
||||
return;
|
||||
|
@ -237,29 +237,15 @@ Mousetrap.bind('c', evt => {
|
|||
// This should do it according to Mousetrap docs, but it doesn't
|
||||
evt.preventDefault();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Archive card has multiple shortcuts
|
||||
Mousetrap.bind('c', archiveCard);
|
||||
Mousetrap.bind('-', archiveCard);
|
||||
|
||||
// Same as above, this time for Persian keyboard.
|
||||
// https://github.com/wekan/wekan/pull/5589#issuecomment-2516776519
|
||||
Mousetrap.bind('÷', evt => {
|
||||
const cardId = getSelectedCardId();
|
||||
if (!cardId) {
|
||||
return;
|
||||
}
|
||||
|
||||
const currentUserId = Meteor.userId();
|
||||
if (currentUserId === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Utils.canModifyBoard()) {
|
||||
const card = ReactiveCache.getCard(cardId);
|
||||
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();
|
||||
}
|
||||
});
|
||||
Mousetrap.bind('÷', archiveCard);
|
||||
|
||||
Mousetrap.bind('n', evt => {
|
||||
const cardId = getSelectedCardId();
|
||||
|
@ -336,7 +322,7 @@ Template.keyboardShortcuts.helpers({
|
|||
action: 'shortcut-assign-self',
|
||||
},
|
||||
{
|
||||
keys: ['c', '÷'],
|
||||
keys: ['c', '÷', '-'],
|
||||
action: 'archive-card',
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue