MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / copyToClipboard

Function copyToClipboard

web/src/hooks/useMessageActions.js:22–37  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

20 }
21
22 const copyToClipboard = async (text) => {
23 if (navigator.clipboard?.writeText) {
24 try {
25 await navigator.clipboard.writeText(text);
26 Toast.success({
27 content: t('消息已复制到剪贴板'),
28 duration: 2,
29 });
30 } catch (err) {
31 console.error('Clipboard API 复制失败:', err);
32 fallbackCopy(text);
33 }
34 } else {
35 fallbackCopy(text);
36 }
37 };
38
39 const fallbackCopy = (text) => {
40 try {

Callers 1

useMessageActionsFunction · 0.85

Calls 2

fallbackCopyFunction · 0.85
tFunction · 0.50

Tested by

no test coverage detected