mirror of
https://github.com/pheralb/svgl.git
synced 2024-11-10 14:46:54 +08:00
🐛 Fix copy to clipboard in Safari
This commit is contained in:
parent
c622b769f7
commit
5328727ff0
@ -122,7 +122,10 @@
|
|||||||
body: JSON.stringify({ code: content, typescript: tsx, name: title })
|
body: JSON.stringify({ code: content, typescript: tsx, name: title })
|
||||||
});
|
});
|
||||||
const data = await getCode.json();
|
const data = await getCode.json();
|
||||||
await navigator.clipboard.writeText(data);
|
const clipboardItem = new ClipboardItem({
|
||||||
|
'text/plain': new Blob([data], { type: 'text/plain' })
|
||||||
|
});
|
||||||
|
await navigator.clipboard.write([clipboardItem]);
|
||||||
toast.success(`Copied as React ${tsx ? 'TSX' : 'JSX'} component`, {
|
toast.success(`Copied as React ${tsx ? 'TSX' : 'JSX'} component`, {
|
||||||
description: `${svgInfo.title} - ${svgInfo.category}`
|
description: `${svgInfo.title} - ${svgInfo.category}`
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user