Skip to content

Commit 6755e12

Browse files
authored
Merge pull request #23 from robmazur/master
Allow for use in Bootstrap modals.
2 parents d1ae98d + a8fc101 commit 6755e12

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

vue-clipboard.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ var Clipboard = require('clipboard/dist/clipboard.min.js') // FIXME: workaround
22

33
var VueClipboard = {
44
install: function (Vue) {
5-
Vue.prototype.$copyText = function (text) {
5+
Vue.prototype.$copyText = function (text, container) {
66
return new Promise(function (resolve, reject) {
77
var fake_el = document.createElement('button');
88
var clipboard = new Clipboard(fake_el, {
99
text: function () { return text },
10-
action: function () { return 'copy' }
10+
action: function () { return 'copy' },
11+
container: typeof container === 'object' ? container : document.body
1112
});
1213
clipboard.on('success', function (e) {
1314
clipboard.destroy();

0 commit comments

Comments
 (0)