mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-09 21:51:29 +08:00
remove last newlines if backspace ends up on newline (#4322) seoulection
This commit is contained in:
parent
801d84fafe
commit
84888c25dd
1 changed files with 13 additions and 0 deletions
|
|
@ -137,6 +137,19 @@ function backspaceToPrevious(): void {
|
|||
Funbox.toggleScript(TestWords.words.getCurrent());
|
||||
TestUI.updateWordElement();
|
||||
|
||||
if (Config.mode === "zen") {
|
||||
const els: HTMLElement[] = (document.querySelector("#words")?.children ||
|
||||
[]) as HTMLElement[];
|
||||
|
||||
for (let i = els.length - 1; i >= 0; i--) {
|
||||
if (els[i].classList.contains("newline")) {
|
||||
els[i].remove();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Caret.updatePosition();
|
||||
Replay.addReplayEvent("backWord");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue