mirror of
https://github.com/ankitects/anki.git
synced 2025-11-06 12:47:11 -05:00
Fix: Check for focus with inner iframe keypress
This commit is contained in:
parent
dae91bd1d8
commit
4e8bf13813
1 changed files with 6 additions and 1 deletions
|
|
@ -58,7 +58,12 @@ addEventListener("message", async (e: MessageEvent<InnerReviewerRequest>) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
addEventListener("keydown", (e) => {
|
addEventListener("keydown", (e) => {
|
||||||
if (e.key.length == 1 && "1234 ".includes(e.key) && !document.activeElement?.matches("#typeans")) {
|
if (e.key === "Enter" && document.activeElement?.matches("#typeans")) {
|
||||||
|
postParentMessage({ type: "keypress", key: " " });
|
||||||
|
} else if (
|
||||||
|
e.key.length == 1 && "1234 ".includes(e.key)
|
||||||
|
&& !document.activeElement?.matches("input[type=text], input[type=number], textarea")
|
||||||
|
) {
|
||||||
postParentMessage({ type: "keypress", key: e.key });
|
postParentMessage({ type: "keypress", key: e.key });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue