Skip to content

Commit

Permalink
fix: ios clipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
tuul-wq committed Oct 21, 2024
1 parent 3cc2049 commit 3ef6bd2
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions app/shared/helpers/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@
*/
export function copyToClipboard(id: string, text: string) {
if (navigator.clipboard) {
navigator.clipboard.writeText(text).catch(error => {
console.info('Could not copy to clipboard, trying fallback', error);
navigator.clipboard
.writeText(text)
.then(() => {
console.log('Text copied to clipboard - ', text);
})
.catch(error => {
console.info('Could not copy to clipboard, trying fallback', error);

copyToClipboardLegacy(id);
});
copyToClipboardLegacy(id);
});
} else {
copyToClipboardLegacy(id);
}
Expand Down

0 comments on commit 3ef6bd2

Please sign in to comment.