Browse Source

Add keyboard shortcut for search

helioguardabaxo 4 years ago
parent
commit
69fc2cd8f8
2 changed files with 13 additions and 0 deletions
  1. 12 0
      client/lib/keyboard.js
  2. 1 0
      i18n/en.i18n.json

+ 12 - 0
client/lib/keyboard.js

@@ -45,6 +45,14 @@ Mousetrap.bind('f', () => {
   }
 });
 
+Mousetrap.bind('/', () => {
+  if (Sidebar.isOpen() && Sidebar.getView() === 'search') {
+    Sidebar.toggle();
+  } else {
+    Sidebar.setView('search');
+  }
+});
+
 Mousetrap.bind(['down', 'up'], (evt, key) => {
   if (!Session.get('currentCard')) {
     return;
@@ -118,6 +126,10 @@ Template.keyboardShortcuts.helpers({
       keys: ['f'],
       action: 'shortcut-toggle-filterbar',
     },
+    {
+      keys: ['/'],
+      action: 'shortcut-toggle-searchbar',
+    },
     {
       keys: ['x'],
       action: 'shortcut-clear-filters',

+ 1 - 0
i18n/en.i18n.json

@@ -488,6 +488,7 @@
   "shortcut-filter-my-cards": "Filter my cards",
   "shortcut-show-shortcuts": "Bring up this shortcuts list",
   "shortcut-toggle-filterbar": "Toggle Filter Sidebar",
+  "shortcut-toggle-searchbar": "Toggle Search Sidebar",
   "shortcut-toggle-sidebar": "Toggle Board Sidebar",
   "show-cards-minimum-count": "Show cards count if list contains more than",
   "sidebar-open": "Open Sidebar",