mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-09 08:40:29 +03:00
Make hotkeys work again (#1819)
This commit is contained in:
parent
c52c4f7d32
commit
c4abe39375
40 changed files with 182 additions and 39 deletions
|
|
@ -1,24 +0,0 @@
|
|||
import { openSearch } from '../action/navigation';
|
||||
import navigation from '../state/navigation';
|
||||
|
||||
function listenKeyboard(event) {
|
||||
// Ctrl/Cmd +
|
||||
if (event.ctrlKey || event.metaKey) {
|
||||
// open search modal
|
||||
if (event.key === 'k') {
|
||||
event.preventDefault();
|
||||
if (navigation.isRawModalVisible) return;
|
||||
openSearch();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function initHotkeys() {
|
||||
document.body.addEventListener('keydown', listenKeyboard);
|
||||
}
|
||||
|
||||
function removeHotkeys() {
|
||||
document.body.removeEventListener('keydown', listenKeyboard);
|
||||
}
|
||||
|
||||
export { initHotkeys, removeHotkeys };
|
||||
Loading…
Add table
Add a link
Reference in a new issue