Skip to content

Commit

Permalink
Reset Clipboard to undefined if native code (#1206)
Browse files Browse the repository at this point in the history
Chrome now ships with a window.Clipboard built in, which breaks
this check. This ensures we're not grabbing the built-in
Clipboard and definitely have the correct package version.

Fixes #1181.
  • Loading branch information
mAAdhaTTah authored and Golmote committed Oct 19, 2017
1 parent ea2d63e commit b41d571
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions plugins/copy-to-clipboard/prism-copy-to-clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

var Clipboard = window.Clipboard || undefined;

if (/(native code)/.test(Clipboard.toString())) {
Clipboard = undefined;
}

if (!Clipboard && typeof require === 'function') {
Clipboard = require('clipboard');
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/copy-to-clipboard/prism-copy-to-clipboard.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b41d571

Please sign in to comment.