extracted shiftKey check into its own if

This commit is contained in:
Miodec 2022-11-14 17:31:22 +01:00
parent e46b6266ae
commit cd5488974c

View file

@ -873,22 +873,22 @@ $(document).keydown(async (event) => {
}
if (event.key === "Enter") {
if (event.shiftKey && Config.mode == "zen") {
TestLogic.finish();
} else if (
event.shiftKey &&
((Config.mode == "time" && Config.time === 0) ||
(Config.mode == "words" && Config.words === 0))
) {
TestInput.setBailout(true);
TestLogic.finish();
} else if (
event.shiftKey &&
Config.mode == "custom" &&
CustomTextState.isCustomTextLong() === true
) {
TestInput.setBailout(true);
TestLogic.finish();
if (event.shiftKey) {
if (Config.mode == "zen") {
TestLogic.finish();
} else if (
(Config.mode == "time" && Config.time === 0) ||
(Config.mode == "words" && Config.words === 0)
) {
TestInput.setBailout(true);
TestLogic.finish();
} else if (
Config.mode == "custom" &&
CustomTextState.isCustomTextLong() === true
) {
TestInput.setBailout(true);
TestLogic.finish();
}
} else {
handleChar("\n", TestInput.input.current.length);
setWordsInput(" " + TestInput.input.current);