From e1168b5107a1dfea0343848cc253d8b525388bff Mon Sep 17 00:00:00 2001 From: Nadav Tasher Date: Sat, 16 Nov 2024 17:40:35 +0200 Subject: [PATCH] Added keyboard shortcut to "assign self" and rename old shortcut to "add self" --- client/lib/keyboard.js | 24 ++++++++++++++++++++++++ imports/i18n/data/en.i18n.json | 1 + 2 files changed, 25 insertions(+) diff --git a/client/lib/keyboard.js b/client/lib/keyboard.js index 79f90456c..81529ff30 100644 --- a/client/lib/keyboard.js +++ b/client/lib/keyboard.js @@ -139,6 +139,26 @@ Mousetrap.bind(numArray, (evt, key) => { } }); +Mousetrap.bind('m', evt => { + const cardId = getSelectedCardId(); + if (!cardId) { + return; + } + + const currentUserId = Meteor.userId(); + if (currentUserId === null) { + return; + } + + if (ReactiveCache.getCurrentUser().isBoardMember()) { + const card = ReactiveCache.getCard(cardId); + card.toggleAssignee(currentUserId); + // 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('space', evt => { const cardId = getSelectedCardId(); if (!cardId) { @@ -219,6 +239,10 @@ Template.keyboardShortcuts.helpers({ }, { keys: ['SPACE'], + action: 'shortcut-add-self', + }, + { + keys: ['n'], action: 'shortcut-assign-self', }, { diff --git a/imports/i18n/data/en.i18n.json b/imports/i18n/data/en.i18n.json index 233c3aec4..46fdf6fd9 100644 --- a/imports/i18n/data/en.i18n.json +++ b/imports/i18n/data/en.i18n.json @@ -574,6 +574,7 @@ "select-board": "Select Board", "set-wip-limit-value": "Set a limit for the maximum number of tasks in this list", "setWipLimitPopup-title": "Set WIP Limit", + "shortcut-add-self": "Add yourself to current card", "shortcut-assign-self": "Assign yourself to current card", "shortcut-autocomplete-emoji": "Autocomplete emoji", "shortcut-autocomplete-members": "Autocomplete members",