Forráskód Böngészése

Move card to archive, add shortcut key ÷ for Persian keyboard.

Thanks to mohammadZahedian and xet7 !

Fixes https://github.com/wekan/wekan/pull/5589,
fixes https://github.com/wekan/wekan/pull/5576.
Lauri Ojansivu 6 hónapja
szülő
commit
80ea1782f9
1 módosított fájl, 23 hozzáadás és 1 törlés
  1. 23 1
      client/lib/keyboard.js

+ 23 - 1
client/lib/keyboard.js

@@ -210,6 +210,28 @@ Mousetrap.bind('`', evt => {
   }
 });
 
+// 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('n', evt => {
   const cardId = getSelectedCardId();
   if (!cardId) {
@@ -285,7 +307,7 @@ Template.keyboardShortcuts.helpers({
       action: 'shortcut-assign-self',
     },
     {
-      keys: ['`'],
+      keys: ['`', '÷'],
       action: 'archive-card',
     },
     {