fix: insert above shortcut (#1020)

refactor: unify setCursor and useEventSelection
This commit is contained in:
Alex Christoffer Rasmussen
2024-06-03 21:34:00 +02:00
committed by GitHub
parent c2039866b4
commit 8b3abe9d61
7 changed files with 209 additions and 64 deletions
@@ -19,13 +19,10 @@ function persistModeToSession(mode: AppMode) {
type AppModeStore = {
mode: AppMode;
setMode: (mode: AppMode) => void;
cursor: string | null;
setCursor: (cursor: string | null) => void;
};
export const useAppMode = create<AppModeStore>()((set) => ({
mode: getModeFromSession(),
cursor: null,
setMode: (mode: AppMode) => {
persistModeToSession(mode);
@@ -33,5 +30,4 @@ export const useAppMode = create<AppModeStore>()((set) => ({
return { mode };
});
},
setCursor: (cursor: string | null) => set({ cursor }),
}));