MCPcopy Create free account
hub / github.com/InternLM/HuixiangDou / CopyCode

Function CopyCode

web/front-end/src/components/copy-code/copy-code.tsx:8–27  ·  view source on GitHub ↗
(props: CopyCodeProps)

Source from the content-addressed store, hash-verified

6}
7
8const CopyCode = (props: CopyCodeProps) => {
9 const { code } = props;
10 const copy = () => {
11 const input = document.createElement('input');
12 input.value = code;
13 document.body.appendChild(input);
14 input.select();
15 document.execCommand('copy');
16 message.success('复制成功');
17 document.body.removeChild(input);
18 };
19 return (
20 <div className={styles.copyCode}>
21 <div className={styles.code}>{code}</div>
22 <div className={styles.copy} onClick={copy}>
23 <IconFont icon="icon-CopyOutlined" />
24 </div>
25 </div>
26 );
27};
28
29export default CopyCode;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected