From 80ea1782f935c74f1b7b1fd0fb7700ef9a39dc64 Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Wed, 4 Dec 2024 14:11:10 +0200 Subject: [PATCH] =?UTF-8?q?Move=20card=20to=20archive,=20add=20shortcut=20?= =?UTF-8?q?key=20=C3=B7=20for=20Persian=20keyboard.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to mohammadZahedian and xet7 ! Fixes https://github.com/wekan/wekan/pull/5589, fixes https://github.com/wekan/wekan/pull/5576. --- client/lib/keyboard.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/client/lib/keyboard.js b/client/lib/keyboard.js index fe58d2ca6..cb42b2533 100644 --- a/client/lib/keyboard.js +++ b/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', }, {