🐛 Fix copy to clipboard in Safari

This commit is contained in:
pheralb 2024-04-09 23:59:59 +01:00
parent c622b769f7
commit 5328727ff0

View File

@ -122,7 +122,10 @@
body: JSON.stringify({ code: content, typescript: tsx, name: title })
});
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`, {
description: `${svgInfo.title} - ${svgInfo.category}`
});