Trying to do something with those keys, but looks like the event is not fired
EditorView.domEventHandlers({
keydown(e, view) {
console.log(e) // logs for every key except enter and backspace
},
});
Trying to do something with those keys, but looks like the event is not fired
EditorView.domEventHandlers({
keydown(e, view) {
console.log(e) // logs for every key except enter and backspace
},
});
If the keydown is preventDefault-ed (which it will be, because of the default keymap), I don’t think keyup fires.
keyup
seem to fire for Enter and Backspace keys, so they’re preventDefault
-ed in keydown
? Why is it necessary (didn’t find it in the codebase yet)?
On closer look, it seems preventing the default doesn’t cause keyup to be suppressed. But I don’t really understand your question—I do get keyup events for enter and backspace when I try this.
Sorry if I wasn’t clear. It’s the keydown
events for Enter
and Backspace
I need but not getting, keyup
does fire on those keys for me
Ah, yeah, you wrote “keyup” in the topic title, which is why I got confused.
This is probably just a matter of event handler precedence—if you wrap your extension in Prec.high
or move it before any other keymap-containing extensions like basicSetup
in your configuration, you should see the output again.
Oops sorry big typo
Yep changing precedence works! Thank you.