Skip to content

Commit

Permalink
UI: in edit mode, hitting <ESC> selects the pod (#448)
Browse files Browse the repository at this point in the history
  • Loading branch information
lihebi committed Aug 13, 2023
1 parent cebad1c commit ced3c7e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ui/src/components/MyMonaco.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ export const MyMonaco = memo<MyMonacoProps>(function MyMonaco({
const provider = useStore(store, (state) => state.provider);
const codeMap = useStore(store, (state) => state.getCodeMap());

const selectPod = useStore(store, (state) => state.selectPod);
const resetSelection = useStore(store, (state) => state.resetSelection);

// FIXME useCallback?
Expand Down Expand Up @@ -500,6 +501,7 @@ export const MyMonaco = memo<MyMonacoProps>(function MyMonaco({
setPodBlur(id);
setCursorNode(id);
setFocusedEditor(undefined);
selectPod(id, true);
}
},
});
Expand Down
2 changes: 2 additions & 0 deletions ui/src/components/nodes/Rich.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,13 @@ function HotkeyControl({ id }) {
const setPodBlur = useStore(store, (state) => state.setPodBlur);
const focusedEditor = useStore(store, (state) => state.focusedEditor);
const setFocusedEditor = useStore(store, (state) => state.setFocusedEditor);
const selectPod = useStore(store, (state) => state.selectPod);

useKeymap("Escape", () => {
setPodBlur(id);
setCursorNode(id);
setFocusedEditor(undefined);
selectPod(id, true);
return true;
});
const commands = useCommands();
Expand Down

0 comments on commit ced3c7e

Please sign in to comment.