Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion frontend/app/store/keymodel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { getLayoutModelForStaticTab } from "@/layout/lib/layoutModelHooks";
import * as keyutil from "@/util/keyutil";
import { fireAndForget } from "@/util/util";
import * as jotai from "jotai";
import { modalsModel } from "./modalmodel";

const simpleControlShiftAtom = jotai.atom(false);
const globalKeyMap = new Map<string, (waveEvent: WaveKeyboardEvent) => boolean>();
Expand Down Expand Up @@ -384,7 +385,16 @@ function registerGlobalKeys() {
return false;
}
globalKeyMap.set("Cmd:f", activateSearch);
globalKeyMap.set("Escape", deactivateSearch);
globalKeyMap.set("Escape", () => {
if (modalsModel.hasOpenModals()) {
modalsModel.popModal();
return true;
}
if (deactivateSearch()) {
return true;
}
return false;
});
const allKeys = Array.from(globalKeyMap.keys());
// special case keys, handled by web view
allKeys.push("Cmd:l", "Cmd:r", "Cmd:ArrowRight", "Cmd:ArrowLeft");
Expand Down
Loading