Skip to content

Commit

Permalink
fix: use clipboardItem for copy async value
Browse files Browse the repository at this point in the history
  • Loading branch information
ooooorobo committed Nov 30, 2024
1 parent d23fee8 commit e0b4406
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/shared/functions/linkUtil.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
export const copyLink = (link: string) => navigator.clipboard.writeText(link);
export const copyLink = (link: string) => {
const blob = new ClipboardItem({
'text/plain': new Blob([link], { type: 'text/plain' }),
});
navigator.clipboard.write([blob]);
};

export const createSharedProfileLink = (shareId: string, fullLink = false) =>
`${fullLink ? location.origin : ''}/share/${shareId}`;
Expand Down

0 comments on commit e0b4406

Please sign in to comment.