mirror of
https://github.com/wekan/wekan.git
synced 2025-12-18 00:10:13 +01:00
Merge pull request #5574 from NadavTasher/feature/support-shortcuts-when-not-using-english-keyboard-layout
Patch to allow shortcuts to work when another keyboard layout is used
This commit is contained in:
commit
3f3e645c96
1 changed files with 11 additions and 0 deletions
|
|
@ -3,6 +3,17 @@ import { ReactiveCache } from '/imports/reactiveCache';
|
||||||
// XXX There is no reason to define these shortcuts globally, they should be
|
// XXX There is no reason to define these shortcuts globally, they should be
|
||||||
// attached to a template (most of them will go in the `board` template).
|
// attached to a template (most of them will go in the `board` template).
|
||||||
|
|
||||||
|
window.addEventListener('keydown', (e) => {
|
||||||
|
// Only handle event if coming from body
|
||||||
|
if (e.target !== document.body) return;
|
||||||
|
|
||||||
|
// Only handle event if it's in another language
|
||||||
|
if (String.fromCharCode(e.which).toLowerCase() === e.key) return;
|
||||||
|
|
||||||
|
// Trigger the corresponding action
|
||||||
|
Mousetrap.trigger(String.fromCharCode(e.which).toLowerCase());
|
||||||
|
});
|
||||||
|
|
||||||
function getHoveredCardId() {
|
function getHoveredCardId() {
|
||||||
const card = $('.js-minicard:hover').get(0);
|
const card = $('.js-minicard:hover').get(0);
|
||||||
if (!card) return null;
|
if (!card) return null;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue