Skip to content

Commit

Permalink
Merge pull request #1433 from laws-africa/sandrava-1336
Browse files Browse the repository at this point in the history
Sandrava 1336
  • Loading branch information
longhotsummer authored Aug 15, 2023
2 parents a7eec1c + 61aaaa1 commit fccd2be
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions peachjam/js/components/clipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@ export class CopyToClipboard {
}

copy () {
navigator.clipboard.writeText(this.root.dataset.value || '')
.then(() => {
this.root.innerText = this.root.dataset.confirmation || 'Copied!';
setTimeout(() => {
this.root.innerText = this.text;
}, 1500);
})
.catch(() => {
this.root.innerText = 'Copy failed!';
setTimeout(() => {
this.root.innerText = this.text;
}, 1500);
});
if (navigator && navigator.clipboard) {
navigator.clipboard.writeText(this.root.dataset.value || '')
.then(() => {
this.root.innerText = this.root.dataset.confirmation || 'Copied!';
setTimeout(() => {
this.root.innerText = this.text;
}, 1500);
})
.catch(() => {
this.root.innerText = 'Copy failed!';
setTimeout(() => {
this.root.innerText = this.text;
}, 1500);
});
}
}
}

0 comments on commit fccd2be

Please sign in to comment.