clipboard-rails 1.5.6 → 1.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/clipboard/rails/version.rb +1 -1
- data/vendor/assets/javascripts/clipboard.js +213 -257
- 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: c30348f2136c33b3d837d1d4c515050acdbf9919
|
4
|
+
data.tar.gz: 5ee1459bb60f84b881859f0aac5b3876d9ce5b43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fae39e25128f423ae43cc84872a71bb4783ab4497b5f5675bdc4b24d1dd3958b29e85110a04e2771ff588cdfe862ed9c1d2d65c21ea524462adf995223cf6738
|
7
|
+
data.tar.gz: 81ea2a6a9f0405cd27fae712517018794ed6043e927915f052781ae9dda91b157c7d876d2e1a2757d4ca9c9e107a13f07ae89053b19cbed75791d4d01e3c4d06
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* clipboard.js v1.5.
|
2
|
+
* clipboard.js v1.5.7
|
3
3
|
* https://zenorocha.github.io/clipboard.js
|
4
4
|
*
|
5
5
|
* Licensed MIT © Zeno Rocha
|
@@ -352,28 +352,24 @@ module.exports = E;
|
|
352
352
|
},{}],8:[function(require,module,exports){
|
353
353
|
'use strict';
|
354
354
|
|
355
|
-
|
355
|
+
exports.__esModule = true;
|
356
356
|
|
357
|
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (
|
357
|
+
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
358
358
|
|
359
|
-
|
360
|
-
|
361
|
-
|
359
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
360
|
+
|
361
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
362
362
|
|
363
363
|
var _select = require('select');
|
364
364
|
|
365
365
|
var _select2 = _interopRequireDefault(_select);
|
366
366
|
|
367
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
368
|
-
|
369
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
370
|
-
|
371
367
|
/**
|
372
368
|
* Inner class which performs selection from either `text` or `target`
|
373
369
|
* properties and then executes copy or cut operations.
|
374
370
|
*/
|
375
371
|
|
376
|
-
var ClipboardAction = function () {
|
372
|
+
var ClipboardAction = (function () {
|
377
373
|
/**
|
378
374
|
* @param {Object} options
|
379
375
|
*/
|
@@ -390,171 +386,154 @@ var ClipboardAction = function () {
|
|
390
386
|
* @param {Object} options
|
391
387
|
*/
|
392
388
|
|
393
|
-
|
394
|
-
|
395
|
-
value: function resolveOptions() {
|
396
|
-
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
389
|
+
ClipboardAction.prototype.resolveOptions = function resolveOptions() {
|
390
|
+
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
397
391
|
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
392
|
+
this.action = options.action;
|
393
|
+
this.emitter = options.emitter;
|
394
|
+
this.target = options.target;
|
395
|
+
this.text = options.text;
|
396
|
+
this.trigger = options.trigger;
|
403
397
|
|
404
|
-
|
405
|
-
|
398
|
+
this.selectedText = '';
|
399
|
+
};
|
406
400
|
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
401
|
+
/**
|
402
|
+
* Decides which selection strategy is going to be applied based
|
403
|
+
* on the existence of `text` and `target` properties.
|
404
|
+
*/
|
411
405
|
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
} else {
|
422
|
-
throw new Error('Missing required attributes, use either "target" or "text"');
|
423
|
-
}
|
406
|
+
ClipboardAction.prototype.initSelection = function initSelection() {
|
407
|
+
if (this.text && this.target) {
|
408
|
+
throw new Error('Multiple attributes declared, use either "target" or "text"');
|
409
|
+
} else if (this.text) {
|
410
|
+
this.selectFake();
|
411
|
+
} else if (this.target) {
|
412
|
+
this.selectTarget();
|
413
|
+
} else {
|
414
|
+
throw new Error('Missing required attributes, use either "target" or "text"');
|
424
415
|
}
|
416
|
+
};
|
425
417
|
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
418
|
+
/**
|
419
|
+
* Creates a fake textarea element, sets its value from `text` property,
|
420
|
+
* and makes a selection on it.
|
421
|
+
*/
|
430
422
|
|
431
|
-
|
432
|
-
|
433
|
-
value: function selectFake() {
|
434
|
-
var _this = this;
|
423
|
+
ClipboardAction.prototype.selectFake = function selectFake() {
|
424
|
+
var _this = this;
|
435
425
|
|
436
|
-
|
426
|
+
var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
|
437
427
|
|
438
|
-
|
428
|
+
this.removeFake();
|
439
429
|
|
440
|
-
|
441
|
-
|
442
|
-
|
430
|
+
this.fakeHandler = document.body.addEventListener('click', function () {
|
431
|
+
return _this.removeFake();
|
432
|
+
});
|
443
433
|
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
434
|
+
this.fakeElem = document.createElement('textarea');
|
435
|
+
this.fakeElem.style.position = 'absolute';
|
436
|
+
this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
|
437
|
+
this.fakeElem.style.top = (window.pageYOffset || document.documentElement.scrollTop) + 'px';
|
438
|
+
this.fakeElem.setAttribute('readonly', '');
|
439
|
+
this.fakeElem.value = this.text;
|
450
440
|
|
451
|
-
|
441
|
+
document.body.appendChild(this.fakeElem);
|
452
442
|
|
453
|
-
|
454
|
-
|
455
|
-
|
443
|
+
this.selectedText = _select2['default'](this.fakeElem);
|
444
|
+
this.copyText();
|
445
|
+
};
|
456
446
|
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
447
|
+
/**
|
448
|
+
* Only removes the fake element after another click event, that way
|
449
|
+
* a user can hit `Ctrl+C` to copy because selection still exists.
|
450
|
+
*/
|
461
451
|
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
this.fakeHandler = null;
|
468
|
-
}
|
452
|
+
ClipboardAction.prototype.removeFake = function removeFake() {
|
453
|
+
if (this.fakeHandler) {
|
454
|
+
document.body.removeEventListener('click');
|
455
|
+
this.fakeHandler = null;
|
456
|
+
}
|
469
457
|
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
}
|
458
|
+
if (this.fakeElem) {
|
459
|
+
document.body.removeChild(this.fakeElem);
|
460
|
+
this.fakeElem = null;
|
474
461
|
}
|
462
|
+
};
|
475
463
|
|
476
|
-
|
477
|
-
|
478
|
-
|
464
|
+
/**
|
465
|
+
* Selects the content from element passed on `target` property.
|
466
|
+
*/
|
479
467
|
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
this.copyText();
|
485
|
-
}
|
468
|
+
ClipboardAction.prototype.selectTarget = function selectTarget() {
|
469
|
+
this.selectedText = _select2['default'](this.target);
|
470
|
+
this.copyText();
|
471
|
+
};
|
486
472
|
|
487
|
-
|
488
|
-
|
489
|
-
|
473
|
+
/**
|
474
|
+
* Executes the copy operation based on the current selection.
|
475
|
+
*/
|
490
476
|
|
491
|
-
|
492
|
-
|
493
|
-
value: function copyText() {
|
494
|
-
var succeeded = undefined;
|
495
|
-
|
496
|
-
try {
|
497
|
-
succeeded = document.execCommand(this.action);
|
498
|
-
} catch (err) {
|
499
|
-
succeeded = false;
|
500
|
-
}
|
477
|
+
ClipboardAction.prototype.copyText = function copyText() {
|
478
|
+
var succeeded = undefined;
|
501
479
|
|
502
|
-
|
480
|
+
try {
|
481
|
+
succeeded = document.execCommand(this.action);
|
482
|
+
} catch (err) {
|
483
|
+
succeeded = false;
|
503
484
|
}
|
504
485
|
|
505
|
-
|
506
|
-
|
507
|
-
* @param {Boolean} succeeded
|
508
|
-
*/
|
486
|
+
this.handleResult(succeeded);
|
487
|
+
};
|
509
488
|
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
this.emitter.emit('success', {
|
515
|
-
action: this.action,
|
516
|
-
text: this.selectedText,
|
517
|
-
trigger: this.trigger,
|
518
|
-
clearSelection: this.clearSelection.bind(this)
|
519
|
-
});
|
520
|
-
} else {
|
521
|
-
this.emitter.emit('error', {
|
522
|
-
action: this.action,
|
523
|
-
trigger: this.trigger,
|
524
|
-
clearSelection: this.clearSelection.bind(this)
|
525
|
-
});
|
526
|
-
}
|
527
|
-
}
|
489
|
+
/**
|
490
|
+
* Fires an event based on the copy operation result.
|
491
|
+
* @param {Boolean} succeeded
|
492
|
+
*/
|
528
493
|
|
529
|
-
|
530
|
-
|
531
|
-
|
494
|
+
ClipboardAction.prototype.handleResult = function handleResult(succeeded) {
|
495
|
+
if (succeeded) {
|
496
|
+
this.emitter.emit('success', {
|
497
|
+
action: this.action,
|
498
|
+
text: this.selectedText,
|
499
|
+
trigger: this.trigger,
|
500
|
+
clearSelection: this.clearSelection.bind(this)
|
501
|
+
});
|
502
|
+
} else {
|
503
|
+
this.emitter.emit('error', {
|
504
|
+
action: this.action,
|
505
|
+
trigger: this.trigger,
|
506
|
+
clearSelection: this.clearSelection.bind(this)
|
507
|
+
});
|
508
|
+
}
|
509
|
+
};
|
532
510
|
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
if (this.target) {
|
537
|
-
this.target.blur();
|
538
|
-
}
|
511
|
+
/**
|
512
|
+
* Removes current selection and focus from `target` element.
|
513
|
+
*/
|
539
514
|
|
540
|
-
|
515
|
+
ClipboardAction.prototype.clearSelection = function clearSelection() {
|
516
|
+
if (this.target) {
|
517
|
+
this.target.blur();
|
541
518
|
}
|
542
519
|
|
543
|
-
|
544
|
-
|
545
|
-
* @param {String} action
|
546
|
-
*/
|
520
|
+
window.getSelection().removeAllRanges();
|
521
|
+
};
|
547
522
|
|
548
|
-
|
549
|
-
|
523
|
+
/**
|
524
|
+
* Sets the `action` to be performed which can be either 'copy' or 'cut'.
|
525
|
+
* @param {String} action
|
526
|
+
*/
|
550
527
|
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
}
|
528
|
+
/**
|
529
|
+
* Destroy lifecycle.
|
530
|
+
*/
|
531
|
+
|
532
|
+
ClipboardAction.prototype.destroy = function destroy() {
|
533
|
+
this.removeFake();
|
534
|
+
};
|
535
|
+
|
536
|
+
_createClass(ClipboardAction, [{
|
558
537
|
key: 'action',
|
559
538
|
set: function set() {
|
560
539
|
var action = arguments.length <= 0 || arguments[0] === undefined ? 'copy' : arguments[0];
|
@@ -564,13 +543,12 @@ var ClipboardAction = function () {
|
|
564
543
|
if (this._action !== 'copy' && this._action !== 'cut') {
|
565
544
|
throw new Error('Invalid "action" value, use either "copy" or "cut"');
|
566
545
|
}
|
567
|
-
}
|
546
|
+
},
|
568
547
|
|
569
548
|
/**
|
570
549
|
* Gets the `action` property.
|
571
550
|
* @return {String}
|
572
551
|
*/
|
573
|
-
,
|
574
552
|
get: function get() {
|
575
553
|
return this._action;
|
576
554
|
}
|
@@ -580,42 +558,43 @@ var ClipboardAction = function () {
|
|
580
558
|
* that will be have its content copied.
|
581
559
|
* @param {Element} target
|
582
560
|
*/
|
583
|
-
|
584
561
|
}, {
|
585
562
|
key: 'target',
|
586
563
|
set: function set(target) {
|
587
564
|
if (target !== undefined) {
|
588
|
-
if (target &&
|
565
|
+
if (target && typeof target === 'object' && target.nodeType === 1) {
|
589
566
|
this._target = target;
|
590
567
|
} else {
|
591
568
|
throw new Error('Invalid "target" value, use a valid Element');
|
592
569
|
}
|
593
570
|
}
|
594
|
-
}
|
571
|
+
},
|
595
572
|
|
596
573
|
/**
|
597
574
|
* Gets the `target` property.
|
598
575
|
* @return {String|HTMLElement}
|
599
576
|
*/
|
600
|
-
,
|
601
577
|
get: function get() {
|
602
578
|
return this._target;
|
603
579
|
}
|
604
580
|
}]);
|
605
581
|
|
606
582
|
return ClipboardAction;
|
607
|
-
}();
|
583
|
+
})();
|
608
584
|
|
609
|
-
exports
|
585
|
+
exports['default'] = ClipboardAction;
|
586
|
+
module.exports = exports['default'];
|
610
587
|
|
611
588
|
},{"select":6}],9:[function(require,module,exports){
|
612
589
|
'use strict';
|
613
590
|
|
614
|
-
|
591
|
+
exports.__esModule = true;
|
592
|
+
|
593
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
615
594
|
|
616
|
-
|
617
|
-
|
618
|
-
});
|
595
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
596
|
+
|
597
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
619
598
|
|
620
599
|
var _clipboardAction = require('./clipboard-action');
|
621
600
|
|
@@ -629,20 +608,12 @@ var _goodListener = require('good-listener');
|
|
629
608
|
|
630
609
|
var _goodListener2 = _interopRequireDefault(_goodListener);
|
631
610
|
|
632
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
633
|
-
|
634
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
635
|
-
|
636
|
-
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
637
|
-
|
638
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
639
|
-
|
640
611
|
/**
|
641
612
|
* Base class which takes one or more elements, adds event listeners to them,
|
642
613
|
* and instantiates a new `ClipboardAction` on each click.
|
643
614
|
*/
|
644
615
|
|
645
|
-
var Clipboard = function (_Emitter) {
|
616
|
+
var Clipboard = (function (_Emitter) {
|
646
617
|
_inherits(Clipboard, _Emitter);
|
647
618
|
|
648
619
|
/**
|
@@ -653,130 +624,114 @@ var Clipboard = function (_Emitter) {
|
|
653
624
|
function Clipboard(trigger, options) {
|
654
625
|
_classCallCheck(this, Clipboard);
|
655
626
|
|
656
|
-
|
627
|
+
_Emitter.call(this);
|
657
628
|
|
658
|
-
|
659
|
-
|
660
|
-
return _this;
|
629
|
+
this.resolveOptions(options);
|
630
|
+
this.listenClick(trigger);
|
661
631
|
}
|
662
632
|
|
633
|
+
/**
|
634
|
+
* Helper function to retrieve attribute value.
|
635
|
+
* @param {String} suffix
|
636
|
+
* @param {Element} element
|
637
|
+
*/
|
638
|
+
|
663
639
|
/**
|
664
640
|
* Defines if attributes would be resolved using internal setter functions
|
665
641
|
* or custom functions that were passed in the constructor.
|
666
642
|
* @param {Object} options
|
667
643
|
*/
|
668
644
|
|
669
|
-
|
670
|
-
|
671
|
-
value: function resolveOptions() {
|
672
|
-
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
645
|
+
Clipboard.prototype.resolveOptions = function resolveOptions() {
|
646
|
+
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
673
647
|
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
/**
|
680
|
-
* Adds a click event listener to the passed trigger.
|
681
|
-
* @param {String|HTMLElement|HTMLCollection|NodeList} trigger
|
682
|
-
*/
|
648
|
+
this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
|
649
|
+
this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
|
650
|
+
this.text = typeof options.text === 'function' ? options.text : this.defaultText;
|
651
|
+
};
|
683
652
|
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
653
|
+
/**
|
654
|
+
* Adds a click event listener to the passed trigger.
|
655
|
+
* @param {String|HTMLElement|HTMLCollection|NodeList} trigger
|
656
|
+
*/
|
688
657
|
|
689
|
-
|
690
|
-
|
691
|
-
});
|
692
|
-
}
|
658
|
+
Clipboard.prototype.listenClick = function listenClick(trigger) {
|
659
|
+
var _this = this;
|
693
660
|
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
661
|
+
this.listener = _goodListener2['default'](trigger, 'click', function (e) {
|
662
|
+
return _this.onClick(e);
|
663
|
+
});
|
664
|
+
};
|
698
665
|
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
666
|
+
/**
|
667
|
+
* Defines a new `ClipboardAction` on each click event.
|
668
|
+
* @param {Event} e
|
669
|
+
*/
|
703
670
|
|
704
|
-
|
705
|
-
|
706
|
-
}
|
671
|
+
Clipboard.prototype.onClick = function onClick(e) {
|
672
|
+
var trigger = e.delegateTarget || e.currentTarget;
|
707
673
|
|
708
|
-
|
709
|
-
|
710
|
-
target: this.target(trigger),
|
711
|
-
text: this.text(trigger),
|
712
|
-
trigger: trigger,
|
713
|
-
emitter: this
|
714
|
-
});
|
674
|
+
if (this.clipboardAction) {
|
675
|
+
this.clipboardAction = null;
|
715
676
|
}
|
716
677
|
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
678
|
+
this.clipboardAction = new _clipboardAction2['default']({
|
679
|
+
action: this.action(trigger),
|
680
|
+
target: this.target(trigger),
|
681
|
+
text: this.text(trigger),
|
682
|
+
trigger: trigger,
|
683
|
+
emitter: this
|
684
|
+
});
|
685
|
+
};
|
721
686
|
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
}
|
687
|
+
/**
|
688
|
+
* Default `action` lookup function.
|
689
|
+
* @param {Element} trigger
|
690
|
+
*/
|
727
691
|
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
*/
|
692
|
+
Clipboard.prototype.defaultAction = function defaultAction(trigger) {
|
693
|
+
return getAttributeValue('action', trigger);
|
694
|
+
};
|
732
695
|
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
696
|
+
/**
|
697
|
+
* Default `target` lookup function.
|
698
|
+
* @param {Element} trigger
|
699
|
+
*/
|
737
700
|
|
738
|
-
|
739
|
-
|
740
|
-
|
701
|
+
Clipboard.prototype.defaultTarget = function defaultTarget(trigger) {
|
702
|
+
var selector = getAttributeValue('target', trigger);
|
703
|
+
|
704
|
+
if (selector) {
|
705
|
+
return document.querySelector(selector);
|
741
706
|
}
|
707
|
+
};
|
742
708
|
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
709
|
+
/**
|
710
|
+
* Default `text` lookup function.
|
711
|
+
* @param {Element} trigger
|
712
|
+
*/
|
747
713
|
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
return getAttributeValue('text', trigger);
|
752
|
-
}
|
714
|
+
Clipboard.prototype.defaultText = function defaultText(trigger) {
|
715
|
+
return getAttributeValue('text', trigger);
|
716
|
+
};
|
753
717
|
|
754
|
-
|
755
|
-
|
756
|
-
|
718
|
+
/**
|
719
|
+
* Destroy lifecycle.
|
720
|
+
*/
|
757
721
|
|
758
|
-
|
759
|
-
|
760
|
-
value: function destroy() {
|
761
|
-
this.listener.destroy();
|
722
|
+
Clipboard.prototype.destroy = function destroy() {
|
723
|
+
this.listener.destroy();
|
762
724
|
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
}
|
725
|
+
if (this.clipboardAction) {
|
726
|
+
this.clipboardAction.destroy();
|
727
|
+
this.clipboardAction = null;
|
767
728
|
}
|
768
|
-
}
|
729
|
+
};
|
769
730
|
|
770
731
|
return Clipboard;
|
771
|
-
}(_tinyEmitter2
|
772
|
-
|
773
|
-
/**
|
774
|
-
* Helper function to retrieve attribute value.
|
775
|
-
* @param {String} suffix
|
776
|
-
* @param {Element} element
|
777
|
-
*/
|
732
|
+
})(_tinyEmitter2['default']);
|
778
733
|
|
779
|
-
exports
|
734
|
+
exports['default'] = Clipboard;
|
780
735
|
function getAttributeValue(suffix, element) {
|
781
736
|
var attribute = 'data-clipboard-' + suffix;
|
782
737
|
|
@@ -786,6 +741,7 @@ function getAttributeValue(suffix, element) {
|
|
786
741
|
|
787
742
|
return element.getAttribute(attribute);
|
788
743
|
}
|
744
|
+
module.exports = exports['default'];
|
789
745
|
|
790
746
|
},{"./clipboard-action":8,"good-listener":4,"tiny-emitter":7}]},{},[9])(9)
|
791
747
|
});
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mohammed Sadiq
|
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
81
|
version: '0'
|
82
82
|
requirements: []
|
83
83
|
rubyforge_project:
|
84
|
-
rubygems_version: 2.5.
|
84
|
+
rubygems_version: 2.5.2
|
85
85
|
signing_key:
|
86
86
|
specification_version: 4
|
87
87
|
summary: ''
|