Эх сурвалжийг харах

Now checking for the meta (Command) key as well as the ctrl key (#3484)

tofarr 1 жил өмнө
parent
commit
5e1d55f2a0

+ 10 - 2
frontend/src/hooks/useTerminal.ts

@@ -55,13 +55,21 @@ export const useTerminal = (commands: Command[] = []) => {
         }
       });
       terminal.current.attachCustomKeyEventHandler((arg) => {
-        if (arg.ctrlKey && arg.code === "KeyV" && arg.type === "keydown") {
+        if (
+          (arg.ctrlKey || arg.metaKey) &&
+          arg.code === "KeyV" &&
+          arg.type === "keydown"
+        ) {
           navigator.clipboard.readText().then((text) => {
             terminal.current?.write(text);
             commandBuffer += text;
           });
         }
-        if (arg.ctrlKey && arg.code === "KeyC" && arg.type === "keydown") {
+        if (
+          (arg.ctrlKey || arg.metaKey) &&
+          arg.code === "KeyC" &&
+          arg.type === "keydown"
+        ) {
           const selection = terminal.current?.getSelection();
           if (selection) {
             const clipboardItem = new ClipboardItem({