Spaces:
Sleeping
Sleeping
File size: 528 Bytes
43a06dc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
const allowedLinkTypes = new Set(["text/plain", "text/uri-list"]);
export const pasteLinkFromClipboard = async () => {
const clipboard = await navigator.clipboard.read();
if (clipboard?.length) {
const clipboardItem = clipboard[0];
for (const type of clipboardItem.types) {
if (allowedLinkTypes.has(type)) {
const blob = await clipboardItem.getType(type);
const blobText = await blob.text();
return blobText;
}
}
}
}
|