import React from "react";
import { setInputCode } from "../Terminal/InputField";

export function ClickablePre({ children }: { children: any }) {
  return (
    <pre className="clickable">
      <code
        onClick={() => {
          setInputCode(
            children.props.children
              .replace(/\s*;.*\n/g, "")
              .replace(/\s+/g, " "),
          );
        }}
      >
        {children}
      </code>
    </pre>
  );
}

import React from "react";
import { setInputCode } from "../Terminal/InputField";

export function ClickablePre({ children }: { children: any }) {
  return (
    <pre className="clickable">
      <code
        onClick={() => {
          setInputCode(children.props.children.replace(/\s*;.*\n/g, ""));
        }}
      >
        {children}
      </code>
    </pre>
  );
}

--- 
+++ 
@@ -6,7 +6,11 @@
     <pre className="clickable">
       <code
         onClick={() => {
-          setInputCode(children.props.children.replace(/\s*;.*\n/g, ""));
+          setInputCode(
+            children.props.children
+              .replace(/\s*;.*\n/g, "")
+              .replace(/\s+/g, " "),
+          );
         }}
       >
         {children}
Remove whitespace from commands copied to terminal
