فهرست منبع

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

tofarr 1 سال پیش
والد
کامیت
5e1d55f2a0
1فایلهای تغییر یافته به همراه10 افزوده شده و 2 حذف شده
  1. 10 2
      frontend/src/hooks/useTerminal.ts

+ 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({