Skip to content

armgit / mimik

Public Imported from GitHub
0

🎬 A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots πŸ“–

feat(desktop): close the capture sheet with Esc

Luis Ortizb723b1b0ee04
diff --git a/apps/desktop/src/renderer/CaptureSheet.tsx b/apps/desktop/src/renderer/CaptureSheet.tsx
index fb5319c..07be8df 100644
--- a/apps/desktop/src/renderer/CaptureSheet.tsx
+++ b/apps/desktop/src/renderer/CaptureSheet.tsx
@@ -19,6 +19,14 @@ export function CaptureSheet({ onClose }: { onClose(): void }) {
window.mimik.capture.settings.get().then(setSettings);
}, []);
+ useEffect(() => {
+ const onKey = (event: KeyboardEvent) => {
+ if (event.key === 'Escape') onClose();
+ };
+ window.addEventListener('keydown', onKey);
+ return () => window.removeEventListener('keydown', onKey);
+ }, [onClose]);
+
const save = async (patch: Partial<CaptureSettings>) => {
setSettings(await window.mimik.capture.settings.set(patch));
};