Skip to content

Commit 0b40a63

Browse files
authored
Check copy result (php-debugbar#678)
1 parent 0143b7c commit 0b40a63

File tree

1 file changed

+6
-5
lines changed
  • src/DebugBar/Resources/widgets/sqlqueries

1 file changed

+6
-5
lines changed

src/DebugBar/Resources/widgets/sqlqueries/widget.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@
2020
var code = $(el).parent('li').find('code').get(0);
2121
var copy = function () {
2222
try {
23-
document.execCommand('copy');
24-
$(el).addClass(csscls('copy-clipboard-check'));
25-
setTimeout(function(){
26-
$(el).removeClass(csscls('copy-clipboard-check'));
27-
}, 2000)
23+
if (document.execCommand('copy')) {
24+
$(el).addClass(csscls('copy-clipboard-check'));
25+
setTimeout(function(){
26+
$(el).removeClass(csscls('copy-clipboard-check'));
27+
}, 2000)
28+
}
2829
} catch (err) {
2930
console.log('Oops, unable to copy');
3031
}

0 commit comments

Comments
 (0)