mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Use key instead of code in type-in field (#3166)
* Use key instead of code in type-in field * Use event.key for Enter
This commit is contained in:
parent
22ecab1a0e
commit
573af9cd4c
2 changed files with 3 additions and 3 deletions
|
@ -116,7 +116,7 @@ function useInputHandler(): [InputHandlerAPI, SetupInputHandlerAction] {
|
||||||
specialKey.dispatch({ event, action: "caretRight" });
|
specialKey.dispatch({ event, action: "caretRight" });
|
||||||
} else if (isArrowLeft(event)) {
|
} else if (isArrowLeft(event)) {
|
||||||
specialKey.dispatch({ event, action: "caretLeft" });
|
specialKey.dispatch({ event, action: "caretLeft" });
|
||||||
} else if (event.code === "Enter" || event.code === "NumpadEnter") {
|
} else if (event.key === "Enter") {
|
||||||
specialKey.dispatch({ event, action: "enter" });
|
specialKey.dispatch({ event, action: "enter" });
|
||||||
} else if (event.code === "Tab") {
|
} else if (event.code === "Tab") {
|
||||||
specialKey.dispatch({ event, action: "tab" });
|
specialKey.dispatch({ event, action: "tab" });
|
||||||
|
|
|
@ -222,8 +222,8 @@ export function _drawMark(mark: boolean): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function _typeAnsPress(): void {
|
export function _typeAnsPress(): void {
|
||||||
const code = (window.event as KeyboardEvent).code;
|
const key = (window.event as KeyboardEvent).key;
|
||||||
if (["Enter", "NumpadEnter"].includes(code)) {
|
if (key === "Enter") {
|
||||||
bridgeCommand("ans");
|
bridgeCommand("ans");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue