mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
only prevent default if we capture the key
This commit is contained in:
@@ -283,18 +283,20 @@ const TerminalView = ({ blockId }: { blockId: string }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function handleKeyDown(e: React.KeyboardEvent<HTMLDivElement>) {
|
function handleKeyDown(e: React.KeyboardEvent<HTMLDivElement>) {
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
const waveEvent = keyutil.adaptFromReactOrNativeKeyEvent(e);
|
const waveEvent = keyutil.adaptFromReactOrNativeKeyEvent(e);
|
||||||
if (keyutil.checkKeyPressed(waveEvent, "Cmd:Shift:v")) {
|
if (keyutil.checkKeyPressed(waveEvent, "Cmd:Shift:v")) {
|
||||||
const p = navigator.clipboard.readText();
|
const p = navigator.clipboard.readText();
|
||||||
p.then((text) => {
|
p.then((text) => {
|
||||||
termRef.current?.handleTermData(text);
|
termRef.current?.handleTermData(text);
|
||||||
});
|
});
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
return true;
|
return true;
|
||||||
} else if (keyutil.checkKeyPressed(waveEvent, "Cmd:Shift:c")) {
|
} else if (keyutil.checkKeyPressed(waveEvent, "Cmd:Shift:c")) {
|
||||||
const sel = termRef.current?.terminal.getSelection();
|
const sel = termRef.current?.terminal.getSelection();
|
||||||
navigator.clipboard.writeText(sel);
|
navigator.clipboard.writeText(sel);
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user