diff --git a/frontend/app/tab/tab.tsx b/frontend/app/tab/tab.tsx index aa3eccebc..0f243c426 100644 --- a/frontend/app/tab/tab.tsx +++ b/frontend/app/tab/tab.tsx @@ -110,6 +110,8 @@ const Tab = forwardRef( function handleContextMenu(e: React.MouseEvent) { e.preventDefault(); let menu: ContextMenuItem[] = []; + menu.push({ label: "Copy TabId", click: () => navigator.clipboard.writeText(id) }); + menu.push({ type: "separator" }); menu.push({ label: "Close Tab", click: () => onClose(null) }); ContextMenuModel.showContextMenu(menu, e); } diff --git a/frontend/app/view/term/term.tsx b/frontend/app/view/term/term.tsx index 337f0f664..a3de76975 100644 --- a/frontend/app/view/term/term.tsx +++ b/frontend/app/view/term/term.tsx @@ -282,8 +282,28 @@ const TerminalView = ({ blockId }: { blockId: string }) => { blockId: blockId, }; + 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); + }); + return true; + } else if (keyutil.checkKeyPressed(waveEvent, "Cmd:Shift:c")) { + const sel = termRef.current?.terminal.getSelection(); + navigator.clipboard.writeText(sel); + return true; + } + } + return ( -
+