diff options
author | Miodec <[email protected]> | 2024-10-15 11:34:27 +0200 |
---|---|---|
committer | Miodec <[email protected]> | 2024-10-15 11:34:27 +0200 |
commit | 4f541da111c2091e1c534ec99571a02c28918f82 (patch) | |
tree | 1ec60fa515be3a80282b4fca5ab6b2ee683efc9d /frontend/src | |
parent | a7664d46ea049a46efbfcd96caece74588ddf693 (diff) | |
download | monkeytype-4f541da111c2091e1c534ec99571a02c28918f82.tar.gz monkeytype-4f541da111c2091e1c534ec99571a02c28918f82.zip |
fix(commandline): don't trigger hover/exec functions if commandline is closing
Diffstat (limited to 'frontend/src')
-rw-r--r-- | frontend/src/ts/commandline/commandline.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/frontend/src/ts/commandline/commandline.ts b/frontend/src/ts/commandline/commandline.ts index 02a634aeb..dea576895 100644 --- a/frontend/src/ts/commandline/commandline.ts +++ b/frontend/src/ts/commandline/commandline.ts @@ -33,6 +33,7 @@ let inputModeParams: InputModeParams = { icon: "", }; let subgroupOverride: CommandsSubgroup | null = null; +let isAnimating = false; function removeCommandlineBackground(): void { $("#commandLine").addClass("noBackground"); @@ -123,6 +124,7 @@ function hide(clearModalChain = false): void { if (ActivePage.get() === "test") { focusWords(); } + isAnimating = true; void modal.hide({ clearModalChain, afterAnimation: async () => { @@ -131,6 +133,7 @@ function hide(clearModalChain = false): void { if (ActivePage.get() === "test" && !isWordsFocused) { focusWords(); } + isAnimating = false; }, }); } @@ -433,6 +436,9 @@ async function showCommands(): Promise<void> { } async function updateActiveCommand(): Promise<void> { + console.log("updating active command"); + if (isAnimating) return; + const elements = [ ...document.querySelectorAll("#commandLine .suggestions .command"), ]; @@ -465,6 +471,7 @@ async function updateActiveCommand(): Promise<void> { } function handleInputSubmit(): void { + if (isAnimating) return; if (inputModeParams.command === null) { throw new Error("Can't handle input submit - command is null"); } @@ -479,6 +486,8 @@ function handleInputSubmit(): void { } async function runActiveCommand(): Promise<void> { + console.log("running active command"); + if (isAnimating) return; if (activeCommand === null) return; const command = activeCommand; if (command.input) { |