mirror of
https://github.com/wekan/wekan.git
synced 2025-12-17 16:00:13 +01: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();
|
const cardId = getSelectedCardId();
|
||||||
if (!cardId) {
|
if (!cardId) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -237,29 +237,15 @@ Mousetrap.bind('c', evt => {
|
||||||
// This should do it according to Mousetrap docs, but it doesn't
|
// This should do it according to Mousetrap docs, but it doesn't
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
|
// Archive card has multiple shortcuts
|
||||||
|
Mousetrap.bind('c', archiveCard);
|
||||||
|
Mousetrap.bind('-', archiveCard);
|
||||||
|
|
||||||
// Same as above, this time for Persian keyboard.
|
// Same as above, this time for Persian keyboard.
|
||||||
// https://github.com/wekan/wekan/pull/5589#issuecomment-2516776519
|
// https://github.com/wekan/wekan/pull/5589#issuecomment-2516776519
|
||||||
Mousetrap.bind('÷', evt => {
|
Mousetrap.bind('÷', archiveCard);
|
||||||
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('n', evt => {
|
Mousetrap.bind('n', evt => {
|
||||||
const cardId = getSelectedCardId();
|
const cardId = getSelectedCardId();
|
||||||
|
|
@ -336,7 +322,7 @@ Template.keyboardShortcuts.helpers({
|
||||||
action: 'shortcut-assign-self',
|
action: 'shortcut-assign-self',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
keys: ['c', '÷'],
|
keys: ['c', '÷', '-'],
|
||||||
action: 'archive-card',
|
action: 'archive-card',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue