fixed a bug where using keymap next with zen mode would freeze the website

This commit is contained in:
Miodec 2021-03-17 17:58:04 +00:00
parent e3a2dc09b8
commit d3a28f6ce3
2 changed files with 13 additions and 12 deletions

View file

@ -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)

View file

@ -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");