Skip to content

Commit

Permalink
Check copy result (#678)
Browse files Browse the repository at this point in the history
  • Loading branch information
barryvdh authored Sep 10, 2024
1 parent 0143b7c commit 0b40a63
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/DebugBar/Resources/widgets/sqlqueries/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
var code = $(el).parent('li').find('code').get(0);
var copy = function () {
try {
document.execCommand('copy');
$(el).addClass(csscls('copy-clipboard-check'));
setTimeout(function(){
$(el).removeClass(csscls('copy-clipboard-check'));
}, 2000)
if (document.execCommand('copy')) {
$(el).addClass(csscls('copy-clipboard-check'));
setTimeout(function(){
$(el).removeClass(csscls('copy-clipboard-check'));
}, 2000)
}
} catch (err) {
console.log('Oops, unable to copy');
}
Expand Down

0 comments on commit 0b40a63

Please sign in to comment.