From 3d00a05aa048fbadc114a4695432b02efb64904e Mon Sep 17 00:00:00 2001 From: sawka Date: Mon, 24 Jun 2024 18:57:01 -0700 Subject: [PATCH] only prevent default if we capture the key --- frontend/app/view/term/term.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/app/view/term/term.tsx b/frontend/app/view/term/term.tsx index a3de76975..53efd0f26 100644 --- a/frontend/app/view/term/term.tsx +++ b/frontend/app/view/term/term.tsx @@ -283,18 +283,20 @@ const TerminalView = ({ blockId }: { blockId: string }) => { }; function handleKeyDown(e: React.KeyboardEvent) { - e.preventDefault(); - e.stopPropagation(); const waveEvent = keyutil.adaptFromReactOrNativeKeyEvent(e); if (keyutil.checkKeyPressed(waveEvent, "Cmd:Shift:v")) { const p = navigator.clipboard.readText(); p.then((text) => { termRef.current?.handleTermData(text); }); + e.preventDefault(); + e.stopPropagation(); return true; } else if (keyutil.checkKeyPressed(waveEvent, "Cmd:Shift:c")) { const sel = termRef.current?.terminal.getSelection(); navigator.clipboard.writeText(sel); + e.preventDefault(); + e.stopPropagation(); return true; } }