mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-11-11 18:03:30 +08:00
fixed a bug where using keymap next with zen mode would freeze the website
This commit is contained in:
parent
e3a2dc09b8
commit
d3a28f6ce3
2 changed files with 13 additions and 12 deletions
|
@ -750,15 +750,15 @@ function showWords() {
|
|||
|
||||
if (Config.mode === "zen") {
|
||||
$(document.querySelector(".word")).remove();
|
||||
}
|
||||
|
||||
if (Config.keymapMode === "next") {
|
||||
Keymap.highlightKey(
|
||||
wordsList[currentWordIndex]
|
||||
.substring(currentInput.length, currentInput.length + 1)
|
||||
.toString()
|
||||
.toUpperCase()
|
||||
);
|
||||
} else {
|
||||
if (Config.keymapMode === "next") {
|
||||
Keymap.highlightKey(
|
||||
wordsList[currentWordIndex]
|
||||
.substring(currentInput.length, currentInput.length + 1)
|
||||
.toString()
|
||||
.toUpperCase()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
TestUI.updateActiveElement();
|
||||
|
@ -4137,7 +4137,7 @@ function handleBackspace(event) {
|
|||
Sound.playClick(Config.playSoundOnClick);
|
||||
if (Config.keymapMode === "react") {
|
||||
Keymap.flashKey(event.code, true);
|
||||
} else if (Config.keymapMode === "next") {
|
||||
} else if (Config.keymapMode === "next" && Config.mode !== "zen") {
|
||||
Keymap.highlightKey(
|
||||
wordsList[currentWordIndex]
|
||||
.substring(currentInput.length, currentInput.length + 1)
|
||||
|
@ -4307,7 +4307,7 @@ function handleSpace(event, isEnter) {
|
|||
|
||||
if (Config.keymapMode === "react") {
|
||||
Keymap.flashKey(event.code, true);
|
||||
} else if (Config.keymapMode === "next") {
|
||||
} else if (Config.keymapMode === "next" && Config.mode !== "zen") {
|
||||
Keymap.highlightKey(
|
||||
wordsList[currentWordIndex]
|
||||
.substring(currentInput.length, currentInput.length + 1)
|
||||
|
@ -4600,7 +4600,7 @@ function handleAlpha(event) {
|
|||
//keymap
|
||||
if (Config.keymapMode === "react") {
|
||||
Keymap.flashKey(event.key, thisCharCorrect);
|
||||
} else if (Config.keymapMode === "next") {
|
||||
} else if (Config.keymapMode === "next" && Config.mode !== "zen") {
|
||||
Keymap.highlightKey(
|
||||
wordsList[currentWordIndex]
|
||||
.substring(currentInput.length, currentInput.length + 1)
|
||||
|
|
|
@ -4,6 +4,7 @@ import layouts from "./layouts";
|
|||
|
||||
//TODO remove after wordslist and currentinput and current word index are in a module
|
||||
export function highlightKey(currentKey) {
|
||||
if (Config.keymapMode === "next") return;
|
||||
try {
|
||||
if ($(".active-key") != undefined) {
|
||||
$(".active-key").removeClass("active-key");
|
||||
|
|
Loading…
Reference in a new issue