clipboard-rails 1.5.13 → 1.5.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/clipboard/rails/version.rb +1 -1
- data/vendor/assets/javascripts/clipboard.js +213 -260
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e56f029fb7779a965754984ddf583a58bef79c93
|
4
|
+
data.tar.gz: d9cdd73bbfae23db57575fca5a751253d7bb9cc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d81c7969e4e174939bb4c645cdab5f7062e2f03ab046401d8eb63321b451868fd05a406ec024db3efb7f20d7f5d4f301dee94fd542257b1cf39ed69efbcc430
|
7
|
+
data.tar.gz: 5fc1adb8656876eb149810b7a56078487396580aaea8aadfbc786e2fddaec8f05b504d350d222ccb77c7692e5b08867c15411b83a4bdb671ff8433ddb0590071
|
@@ -1,124 +1,41 @@
|
|
1
1
|
/*!
|
2
|
-
* clipboard.js v1.5.
|
2
|
+
* clipboard.js v1.5.15
|
3
3
|
* https://zenorocha.github.io/clipboard.js
|
4
4
|
*
|
5
5
|
* Licensed MIT © Zeno Rocha
|
6
6
|
*/
|
7
7
|
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Clipboard = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
8
8
|
/**
|
9
|
-
*
|
9
|
+
* A polyfill for Element.matches()
|
10
10
|
*/
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
* Export `closest`
|
20
|
-
*/
|
21
|
-
|
22
|
-
module.exports = closest
|
23
|
-
|
24
|
-
/**
|
25
|
-
* Closest
|
26
|
-
*
|
27
|
-
* @param {Element} el
|
28
|
-
* @param {String} selector
|
29
|
-
* @param {Element} scope (optional)
|
30
|
-
*/
|
31
|
-
|
32
|
-
function closest (el, selector, scope) {
|
33
|
-
scope = scope || document.documentElement;
|
34
|
-
|
35
|
-
// walk up the dom
|
36
|
-
while (el && el !== scope) {
|
37
|
-
if (matches(el, selector)) return el;
|
38
|
-
el = el.parentNode;
|
39
|
-
}
|
40
|
-
|
41
|
-
// check scope for match
|
42
|
-
return matches(el, selector) ? el : null;
|
43
|
-
}
|
44
|
-
|
45
|
-
},{"component-matches-selector":2,"matches-selector":2}],2:[function(require,module,exports){
|
46
|
-
/**
|
47
|
-
* Module dependencies.
|
48
|
-
*/
|
49
|
-
|
50
|
-
try {
|
51
|
-
var query = require('query');
|
52
|
-
} catch (err) {
|
53
|
-
var query = require('component-query');
|
11
|
+
if (Element && !Element.prototype.matches) {
|
12
|
+
var proto = Element.prototype;
|
13
|
+
|
14
|
+
proto.matches = proto.matchesSelector ||
|
15
|
+
proto.mozMatchesSelector ||
|
16
|
+
proto.msMatchesSelector ||
|
17
|
+
proto.oMatchesSelector ||
|
18
|
+
proto.webkitMatchesSelector;
|
54
19
|
}
|
55
20
|
|
56
21
|
/**
|
57
|
-
*
|
58
|
-
*/
|
59
|
-
|
60
|
-
var proto = Element.prototype;
|
61
|
-
|
62
|
-
/**
|
63
|
-
* Vendor function.
|
64
|
-
*/
|
65
|
-
|
66
|
-
var vendor = proto.matches
|
67
|
-
|| proto.webkitMatchesSelector
|
68
|
-
|| proto.mozMatchesSelector
|
69
|
-
|| proto.msMatchesSelector
|
70
|
-
|| proto.oMatchesSelector;
|
71
|
-
|
72
|
-
/**
|
73
|
-
* Expose `match()`.
|
74
|
-
*/
|
75
|
-
|
76
|
-
module.exports = match;
|
77
|
-
|
78
|
-
/**
|
79
|
-
* Match `el` to `selector`.
|
22
|
+
* Finds the closest parent that matches a selector.
|
80
23
|
*
|
81
|
-
* @param {Element}
|
24
|
+
* @param {Element} element
|
82
25
|
* @param {String} selector
|
83
|
-
* @return {
|
84
|
-
* @api public
|
26
|
+
* @return {Function}
|
85
27
|
*/
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
for (var i = 0; i < nodes.length; ++i) {
|
92
|
-
if (nodes[i] == el) return true;
|
93
|
-
}
|
94
|
-
return false;
|
95
|
-
}
|
96
|
-
|
97
|
-
},{"component-query":3,"query":3}],3:[function(require,module,exports){
|
98
|
-
function one(selector, el) {
|
99
|
-
return el.querySelector(selector);
|
28
|
+
function closest (element, selector) {
|
29
|
+
while (element && element !== document) {
|
30
|
+
if (element.matches(selector)) return element;
|
31
|
+
element = element.parentNode;
|
32
|
+
}
|
100
33
|
}
|
101
34
|
|
102
|
-
|
103
|
-
el = el || document;
|
104
|
-
return one(selector, el);
|
105
|
-
};
|
106
|
-
|
107
|
-
exports.all = function(selector, el){
|
108
|
-
el = el || document;
|
109
|
-
return el.querySelectorAll(selector);
|
110
|
-
};
|
111
|
-
|
112
|
-
exports.engine = function(obj){
|
113
|
-
if (!obj.one) throw new Error('.one callback required');
|
114
|
-
if (!obj.all) throw new Error('.all callback required');
|
115
|
-
one = obj.one;
|
116
|
-
exports.all = obj.all;
|
117
|
-
return exports;
|
118
|
-
};
|
35
|
+
module.exports = closest;
|
119
36
|
|
120
|
-
},{}],
|
121
|
-
var closest = require('
|
37
|
+
},{}],2:[function(require,module,exports){
|
38
|
+
var closest = require('./closest');
|
122
39
|
|
123
40
|
/**
|
124
41
|
* Delegates event to a selector.
|
@@ -153,7 +70,7 @@ function delegate(element, selector, type, callback, useCapture) {
|
|
153
70
|
*/
|
154
71
|
function listener(element, selector, type, callback) {
|
155
72
|
return function(e) {
|
156
|
-
e.delegateTarget = closest(e.target, selector
|
73
|
+
e.delegateTarget = closest(e.target, selector);
|
157
74
|
|
158
75
|
if (e.delegateTarget) {
|
159
76
|
callback.call(element, e);
|
@@ -163,7 +80,7 @@ function listener(element, selector, type, callback) {
|
|
163
80
|
|
164
81
|
module.exports = delegate;
|
165
82
|
|
166
|
-
},{"
|
83
|
+
},{"./closest":1}],3:[function(require,module,exports){
|
167
84
|
/**
|
168
85
|
* Check if argument is a HTML element.
|
169
86
|
*
|
@@ -214,7 +131,7 @@ exports.fn = function(value) {
|
|
214
131
|
return type === '[object Function]';
|
215
132
|
};
|
216
133
|
|
217
|
-
},{}],
|
134
|
+
},{}],4:[function(require,module,exports){
|
218
135
|
var is = require('./is');
|
219
136
|
var delegate = require('delegate');
|
220
137
|
|
@@ -311,7 +228,7 @@ function listenSelector(selector, type, callback) {
|
|
311
228
|
|
312
229
|
module.exports = listen;
|
313
230
|
|
314
|
-
},{"./is":
|
231
|
+
},{"./is":3,"delegate":2}],5:[function(require,module,exports){
|
315
232
|
function select(element) {
|
316
233
|
var selectedText;
|
317
234
|
|
@@ -346,7 +263,7 @@ function select(element) {
|
|
346
263
|
|
347
264
|
module.exports = select;
|
348
265
|
|
349
|
-
},{}],
|
266
|
+
},{}],6:[function(require,module,exports){
|
350
267
|
function E () {
|
351
268
|
// Keep this empty so it's easier to inherit from
|
352
269
|
// (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
|
@@ -414,7 +331,7 @@ E.prototype = {
|
|
414
331
|
|
415
332
|
module.exports = E;
|
416
333
|
|
417
|
-
},{}],
|
334
|
+
},{}],7:[function(require,module,exports){
|
418
335
|
(function (global, factory) {
|
419
336
|
if (typeof define === "function" && define.amd) {
|
420
337
|
define(['module', 'select'], factory);
|
@@ -441,7 +358,7 @@ module.exports = E;
|
|
441
358
|
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
442
359
|
return typeof obj;
|
443
360
|
} : function (obj) {
|
444
|
-
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
361
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
445
362
|
};
|
446
363
|
|
447
364
|
function _classCallCheck(instance, Constructor) {
|
@@ -485,117 +402,126 @@ module.exports = E;
|
|
485
402
|
*/
|
486
403
|
|
487
404
|
|
488
|
-
ClipboardAction
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
this.emitter = options.emitter;
|
493
|
-
this.target = options.target;
|
494
|
-
this.text = options.text;
|
495
|
-
this.trigger = options.trigger;
|
405
|
+
_createClass(ClipboardAction, [{
|
406
|
+
key: 'resolveOptions',
|
407
|
+
value: function resolveOptions() {
|
408
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
496
409
|
|
497
|
-
|
498
|
-
|
410
|
+
this.action = options.action;
|
411
|
+
this.emitter = options.emitter;
|
412
|
+
this.target = options.target;
|
413
|
+
this.text = options.text;
|
414
|
+
this.trigger = options.trigger;
|
499
415
|
|
500
|
-
|
501
|
-
if (this.text) {
|
502
|
-
this.selectFake();
|
503
|
-
} else if (this.target) {
|
504
|
-
this.selectTarget();
|
416
|
+
this.selectedText = '';
|
505
417
|
}
|
506
|
-
}
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
this.fakeHandlerCallback = function () {
|
516
|
-
return _this.removeFake();
|
517
|
-
};
|
518
|
-
this.fakeHandler = document.body.addEventListener('click', this.fakeHandlerCallback) || true;
|
519
|
-
|
520
|
-
this.fakeElem = document.createElement('textarea');
|
521
|
-
// Prevent zooming on iOS
|
522
|
-
this.fakeElem.style.fontSize = '12pt';
|
523
|
-
// Reset box model
|
524
|
-
this.fakeElem.style.border = '0';
|
525
|
-
this.fakeElem.style.padding = '0';
|
526
|
-
this.fakeElem.style.margin = '0';
|
527
|
-
// Move element out of screen horizontally
|
528
|
-
this.fakeElem.style.position = 'absolute';
|
529
|
-
this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
|
530
|
-
// Move element to the same position vertically
|
531
|
-
var yPosition = window.pageYOffset || document.documentElement.scrollTop;
|
532
|
-
this.fakeElem.addEventListener('focus', window.scrollTo(0, yPosition));
|
533
|
-
this.fakeElem.style.top = yPosition + 'px';
|
534
|
-
|
535
|
-
this.fakeElem.setAttribute('readonly', '');
|
536
|
-
this.fakeElem.value = this.text;
|
537
|
-
|
538
|
-
document.body.appendChild(this.fakeElem);
|
539
|
-
|
540
|
-
this.selectedText = (0, _select2.default)(this.fakeElem);
|
541
|
-
this.copyText();
|
542
|
-
};
|
543
|
-
|
544
|
-
ClipboardAction.prototype.removeFake = function removeFake() {
|
545
|
-
if (this.fakeHandler) {
|
546
|
-
document.body.removeEventListener('click', this.fakeHandlerCallback);
|
547
|
-
this.fakeHandler = null;
|
548
|
-
this.fakeHandlerCallback = null;
|
418
|
+
}, {
|
419
|
+
key: 'initSelection',
|
420
|
+
value: function initSelection() {
|
421
|
+
if (this.text) {
|
422
|
+
this.selectFake();
|
423
|
+
} else if (this.target) {
|
424
|
+
this.selectTarget();
|
425
|
+
}
|
549
426
|
}
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
427
|
+
}, {
|
428
|
+
key: 'selectFake',
|
429
|
+
value: function selectFake() {
|
430
|
+
var _this = this;
|
431
|
+
|
432
|
+
var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
|
433
|
+
|
434
|
+
this.removeFake();
|
435
|
+
|
436
|
+
this.fakeHandlerCallback = function () {
|
437
|
+
return _this.removeFake();
|
438
|
+
};
|
439
|
+
this.fakeHandler = document.body.addEventListener('click', this.fakeHandlerCallback) || true;
|
440
|
+
|
441
|
+
this.fakeElem = document.createElement('textarea');
|
442
|
+
// Prevent zooming on iOS
|
443
|
+
this.fakeElem.style.fontSize = '12pt';
|
444
|
+
// Reset box model
|
445
|
+
this.fakeElem.style.border = '0';
|
446
|
+
this.fakeElem.style.padding = '0';
|
447
|
+
this.fakeElem.style.margin = '0';
|
448
|
+
// Move element out of screen horizontally
|
449
|
+
this.fakeElem.style.position = 'absolute';
|
450
|
+
this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
|
451
|
+
// Move element to the same position vertically
|
452
|
+
var yPosition = window.pageYOffset || document.documentElement.scrollTop;
|
453
|
+
this.fakeElem.addEventListener('focus', window.scrollTo(0, yPosition));
|
454
|
+
this.fakeElem.style.top = yPosition + 'px';
|
455
|
+
|
456
|
+
this.fakeElem.setAttribute('readonly', '');
|
457
|
+
this.fakeElem.value = this.text;
|
458
|
+
|
459
|
+
document.body.appendChild(this.fakeElem);
|
460
|
+
|
461
|
+
this.selectedText = (0, _select2.default)(this.fakeElem);
|
462
|
+
this.copyText();
|
554
463
|
}
|
555
|
-
}
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
var succeeded = void 0;
|
464
|
+
}, {
|
465
|
+
key: 'removeFake',
|
466
|
+
value: function removeFake() {
|
467
|
+
if (this.fakeHandler) {
|
468
|
+
document.body.removeEventListener('click', this.fakeHandlerCallback);
|
469
|
+
this.fakeHandler = null;
|
470
|
+
this.fakeHandlerCallback = null;
|
471
|
+
}
|
564
472
|
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
473
|
+
if (this.fakeElem) {
|
474
|
+
document.body.removeChild(this.fakeElem);
|
475
|
+
this.fakeElem = null;
|
476
|
+
}
|
569
477
|
}
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
this.emitter.emit(succeeded ? 'success' : 'error', {
|
576
|
-
action: this.action,
|
577
|
-
text: this.selectedText,
|
578
|
-
trigger: this.trigger,
|
579
|
-
clearSelection: this.clearSelection.bind(this)
|
580
|
-
});
|
581
|
-
};
|
582
|
-
|
583
|
-
ClipboardAction.prototype.clearSelection = function clearSelection() {
|
584
|
-
if (this.target) {
|
585
|
-
this.target.blur();
|
478
|
+
}, {
|
479
|
+
key: 'selectTarget',
|
480
|
+
value: function selectTarget() {
|
481
|
+
this.selectedText = (0, _select2.default)(this.target);
|
482
|
+
this.copyText();
|
586
483
|
}
|
484
|
+
}, {
|
485
|
+
key: 'copyText',
|
486
|
+
value: function copyText() {
|
487
|
+
var succeeded = void 0;
|
488
|
+
|
489
|
+
try {
|
490
|
+
succeeded = document.execCommand(this.action);
|
491
|
+
} catch (err) {
|
492
|
+
succeeded = false;
|
493
|
+
}
|
587
494
|
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
495
|
+
this.handleResult(succeeded);
|
496
|
+
}
|
497
|
+
}, {
|
498
|
+
key: 'handleResult',
|
499
|
+
value: function handleResult(succeeded) {
|
500
|
+
this.emitter.emit(succeeded ? 'success' : 'error', {
|
501
|
+
action: this.action,
|
502
|
+
text: this.selectedText,
|
503
|
+
trigger: this.trigger,
|
504
|
+
clearSelection: this.clearSelection.bind(this)
|
505
|
+
});
|
506
|
+
}
|
507
|
+
}, {
|
508
|
+
key: 'clearSelection',
|
509
|
+
value: function clearSelection() {
|
510
|
+
if (this.target) {
|
511
|
+
this.target.blur();
|
512
|
+
}
|
594
513
|
|
595
|
-
|
514
|
+
window.getSelection().removeAllRanges();
|
515
|
+
}
|
516
|
+
}, {
|
517
|
+
key: 'destroy',
|
518
|
+
value: function destroy() {
|
519
|
+
this.removeFake();
|
520
|
+
}
|
521
|
+
}, {
|
596
522
|
key: 'action',
|
597
523
|
set: function set() {
|
598
|
-
var action = arguments.length
|
524
|
+
var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
|
599
525
|
|
600
526
|
this._action = action;
|
601
527
|
|
@@ -636,7 +562,7 @@ module.exports = E;
|
|
636
562
|
module.exports = ClipboardAction;
|
637
563
|
});
|
638
564
|
|
639
|
-
},{"select":
|
565
|
+
},{"select":5}],8:[function(require,module,exports){
|
640
566
|
(function (global, factory) {
|
641
567
|
if (typeof define === "function" && define.amd) {
|
642
568
|
define(['module', './clipboard-action', 'tiny-emitter', 'good-listener'], factory);
|
@@ -670,6 +596,24 @@ module.exports = E;
|
|
670
596
|
}
|
671
597
|
}
|
672
598
|
|
599
|
+
var _createClass = function () {
|
600
|
+
function defineProperties(target, props) {
|
601
|
+
for (var i = 0; i < props.length; i++) {
|
602
|
+
var descriptor = props[i];
|
603
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
604
|
+
descriptor.configurable = true;
|
605
|
+
if ("value" in descriptor) descriptor.writable = true;
|
606
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
607
|
+
}
|
608
|
+
}
|
609
|
+
|
610
|
+
return function (Constructor, protoProps, staticProps) {
|
611
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
612
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
613
|
+
return Constructor;
|
614
|
+
};
|
615
|
+
}();
|
616
|
+
|
673
617
|
function _possibleConstructorReturn(self, call) {
|
674
618
|
if (!self) {
|
675
619
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
@@ -704,7 +648,7 @@ module.exports = E;
|
|
704
648
|
function Clipboard(trigger, options) {
|
705
649
|
_classCallCheck(this, Clipboard);
|
706
650
|
|
707
|
-
var _this = _possibleConstructorReturn(this,
|
651
|
+
var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
|
708
652
|
|
709
653
|
_this.resolveOptions(options);
|
710
654
|
_this.listenClick(trigger);
|
@@ -718,62 +662,71 @@ module.exports = E;
|
|
718
662
|
*/
|
719
663
|
|
720
664
|
|
721
|
-
Clipboard
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
|
726
|
-
this.text = typeof options.text === 'function' ? options.text : this.defaultText;
|
727
|
-
};
|
728
|
-
|
729
|
-
Clipboard.prototype.listenClick = function listenClick(trigger) {
|
730
|
-
var _this2 = this;
|
731
|
-
|
732
|
-
this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
|
733
|
-
return _this2.onClick(e);
|
734
|
-
});
|
735
|
-
};
|
665
|
+
_createClass(Clipboard, [{
|
666
|
+
key: 'resolveOptions',
|
667
|
+
value: function resolveOptions() {
|
668
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
736
669
|
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
if (this.clipboardAction) {
|
741
|
-
this.clipboardAction = null;
|
670
|
+
this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
|
671
|
+
this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
|
672
|
+
this.text = typeof options.text === 'function' ? options.text : this.defaultText;
|
742
673
|
}
|
674
|
+
}, {
|
675
|
+
key: 'listenClick',
|
676
|
+
value: function listenClick(trigger) {
|
677
|
+
var _this2 = this;
|
743
678
|
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
Clipboard.prototype.defaultAction = function defaultAction(trigger) {
|
754
|
-
return getAttributeValue('action', trigger);
|
755
|
-
};
|
679
|
+
this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
|
680
|
+
return _this2.onClick(e);
|
681
|
+
});
|
682
|
+
}
|
683
|
+
}, {
|
684
|
+
key: 'onClick',
|
685
|
+
value: function onClick(e) {
|
686
|
+
var trigger = e.delegateTarget || e.currentTarget;
|
756
687
|
|
757
|
-
|
758
|
-
|
688
|
+
if (this.clipboardAction) {
|
689
|
+
this.clipboardAction = null;
|
690
|
+
}
|
759
691
|
|
760
|
-
|
761
|
-
|
692
|
+
this.clipboardAction = new _clipboardAction2.default({
|
693
|
+
action: this.action(trigger),
|
694
|
+
target: this.target(trigger),
|
695
|
+
text: this.text(trigger),
|
696
|
+
trigger: trigger,
|
697
|
+
emitter: this
|
698
|
+
});
|
762
699
|
}
|
763
|
-
}
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
700
|
+
}, {
|
701
|
+
key: 'defaultAction',
|
702
|
+
value: function defaultAction(trigger) {
|
703
|
+
return getAttributeValue('action', trigger);
|
704
|
+
}
|
705
|
+
}, {
|
706
|
+
key: 'defaultTarget',
|
707
|
+
value: function defaultTarget(trigger) {
|
708
|
+
var selector = getAttributeValue('target', trigger);
|
768
709
|
|
769
|
-
|
770
|
-
|
710
|
+
if (selector) {
|
711
|
+
return document.querySelector(selector);
|
712
|
+
}
|
713
|
+
}
|
714
|
+
}, {
|
715
|
+
key: 'defaultText',
|
716
|
+
value: function defaultText(trigger) {
|
717
|
+
return getAttributeValue('text', trigger);
|
718
|
+
}
|
719
|
+
}, {
|
720
|
+
key: 'destroy',
|
721
|
+
value: function destroy() {
|
722
|
+
this.listener.destroy();
|
771
723
|
|
772
|
-
|
773
|
-
|
774
|
-
|
724
|
+
if (this.clipboardAction) {
|
725
|
+
this.clipboardAction.destroy();
|
726
|
+
this.clipboardAction = null;
|
727
|
+
}
|
775
728
|
}
|
776
|
-
};
|
729
|
+
}]);
|
777
730
|
|
778
731
|
return Clipboard;
|
779
732
|
}(_tinyEmitter2.default);
|
@@ -796,5 +749,5 @@ module.exports = E;
|
|
796
749
|
module.exports = Clipboard;
|
797
750
|
});
|
798
751
|
|
799
|
-
},{"./clipboard-action":
|
752
|
+
},{"./clipboard-action":7,"good-listener":4,"tiny-emitter":6}]},{},[8])(8)
|
800
753
|
});
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clipboard-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mohammed Sadiq
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|