mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
only prevent default if we capture the key
This commit is contained in:
parent
bd2bb5293f
commit
3d00a05aa0
@ -283,18 +283,20 @@ const TerminalView = ({ blockId }: { blockId: string }) => {
|
||||
};
|
||||
|
||||
function handleKeyDown(e: React.KeyboardEvent<HTMLDivElement>) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user