浏览代码

Add additional archiving keyboard shortcut

Nadav Tasher 5 月之前
父节点
当前提交
503298a33f
共有 1 个文件被更改,包括 8 次插入22 次删除
  1. 8 22
      client/lib/keyboard.js

+ 8 - 22
client/lib/keyboard.js

@@ -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',
     },
     {