Skip to content

Commit

Permalink
Merge pull request #244 from novasamatech/fix/clipboard_ios
Browse files Browse the repository at this point in the history
Fix: iOS Clipboard
  • Loading branch information
tuul-wq authored Oct 21, 2024
2 parents 3cc2049 + 3ef6bd2 commit 8bed2f1
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 8bed2f1

Please sign in to comment.