Browse Source

Fix upper-case keyboard shortcuts & different language shortcuts getting triggered when shortcuts are disabled

Nadav Tasher 5 tháng trước cách đây
mục cha
commit
26e78a1381
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      client/lib/keyboard.js

+ 2 - 2
client/lib/keyboard.js

@@ -11,13 +11,13 @@ window.addEventListener('keydown', (e) => {
   if (String.fromCharCode(e.which).toLowerCase() === e.key) return;
 
   // Trigger the corresponding action
-  Mousetrap.trigger(String.fromCharCode(e.which).toLowerCase());
+  Mousetrap.handleKey(String.fromCharCode(e.which).toLowerCase(), [], {type: "keypress"});
 });
 
 // Overwrite the stopCallback to allow for more keyboard shortcut customizations
 Mousetrap.stopCallback = (event, element) => {
   // Are shortcuts enabled for the user?
-  if (!ReactiveCache.getCurrentUser().isKeyboardShortcuts())
+  if (ReactiveCache.getCurrentUser() && !ReactiveCache.getCurrentUser().isKeyboardShortcuts())
     return true;
 
   // Always handle escape