Commit 6a8b0cf 1 parent 1cf5eb3 commit 6a8b0cf Copy full SHA for 6a8b0cf
File tree 2 files changed +15
-0
lines changed
src/entrypoints/gregmat.content
2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " gregmat-buddy " : patch
3
+ ---
4
+
5
+ fixed keybinds active while typing notes
Original file line number Diff line number Diff line change @@ -16,10 +16,18 @@ const keys = {
16
16
right : eventGenerator ( "ArrowRight" ) ,
17
17
} as const ;
18
18
19
+ function isNotesFocused ( ) {
20
+ const note = document . getElementById ( "note" ) ;
21
+
22
+ return document . activeElement == note ;
23
+ }
24
+
19
25
function registerKeybinds ( ) {
20
26
document . addEventListener ( "keydown" , ( ev ) => {
21
27
let key = null ;
22
28
29
+ if ( isNotesFocused ( ) ) return ;
30
+
23
31
switch ( ev . key ) {
24
32
case String ( ev . key . match ( / ^ j $ / i) ) :
25
33
key = keys . down ;
@@ -46,6 +54,8 @@ function registerKeybinds() {
46
54
document . addEventListener ( "keyup" , ( ev ) => {
47
55
if ( ! ev . key . match ( / ^ [ g r f ] $ / i) ) return ;
48
56
57
+ if ( isNotesFocused ( ) ) return ;
58
+
49
59
document . body . dispatchEvent ( keys . down ) ;
50
60
} ) ;
51
61
}
You can’t perform that action at this time.
0 commit comments