clipboard-rails 1.5.8 → 1.5.9
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 +304 -323
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 077ff103bd6ab5e0fe17a5be37211ed983793776
|
4
|
+
data.tar.gz: 3309368552404247f57e5380305a306c4c23612d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8689af10933aac18159d1bd592207996d2e7c1f92386277405d77a40a770c344b962e88c5eebf36f0b443eeb73e7d1bc47d5ff8101bda8c8a2b4d13432be39a5
|
7
|
+
data.tar.gz: 5871a35c815fe5c7a69ab8fe881d33097b2ea7b114f75313969cc7968ecbdb823526c6ccd3ec20376f606ba721dd91e3a1f901b0c6dd17902ed8e8ecfe6b6d78
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* clipboard.js v1.5.
|
2
|
+
* clipboard.js v1.5.9
|
3
3
|
* https://zenorocha.github.io/clipboard.js
|
4
4
|
*
|
5
5
|
* Licensed MIT © Zeno Rocha
|
@@ -350,406 +350,387 @@ E.prototype = {
|
|
350
350
|
module.exports = E;
|
351
351
|
|
352
352
|
},{}],8:[function(require,module,exports){
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
var _select2 = _interopRequireDefault(_select);
|
366
|
-
|
367
|
-
/**
|
368
|
-
* Inner class which performs selection from either `text` or `target`
|
369
|
-
* properties and then executes copy or cut operations.
|
370
|
-
*/
|
371
|
-
|
372
|
-
var ClipboardAction = (function () {
|
373
|
-
/**
|
374
|
-
* @param {Object} options
|
375
|
-
*/
|
376
|
-
|
377
|
-
function ClipboardAction(options) {
|
378
|
-
_classCallCheck(this, ClipboardAction);
|
379
|
-
|
380
|
-
this.resolveOptions(options);
|
381
|
-
this.initSelection();
|
353
|
+
(function (global, factory) {
|
354
|
+
if (typeof define === "function" && define.amd) {
|
355
|
+
define(['module', 'select'], factory);
|
356
|
+
} else if (typeof exports !== "undefined") {
|
357
|
+
factory(module, require('select'));
|
358
|
+
} else {
|
359
|
+
var mod = {
|
360
|
+
exports: {}
|
361
|
+
};
|
362
|
+
factory(mod, global.select);
|
363
|
+
global.clipboardAction = mod.exports;
|
382
364
|
}
|
365
|
+
})(this, function (module, _select) {
|
366
|
+
'use strict';
|
383
367
|
|
384
|
-
|
385
|
-
* Defines base properties passed from constructor.
|
386
|
-
* @param {Object} options
|
387
|
-
*/
|
368
|
+
var _select2 = _interopRequireDefault(_select);
|
388
369
|
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
this.target = options.target;
|
395
|
-
this.text = options.text;
|
396
|
-
this.trigger = options.trigger;
|
370
|
+
function _interopRequireDefault(obj) {
|
371
|
+
return obj && obj.__esModule ? obj : {
|
372
|
+
default: obj
|
373
|
+
};
|
374
|
+
}
|
397
375
|
|
398
|
-
|
376
|
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
377
|
+
return typeof obj;
|
378
|
+
} : function (obj) {
|
379
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
399
380
|
};
|
400
381
|
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
382
|
+
function _classCallCheck(instance, Constructor) {
|
383
|
+
if (!(instance instanceof Constructor)) {
|
384
|
+
throw new TypeError("Cannot call a class as a function");
|
385
|
+
}
|
386
|
+
}
|
405
387
|
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
388
|
+
var _createClass = function () {
|
389
|
+
function defineProperties(target, props) {
|
390
|
+
for (var i = 0; i < props.length; i++) {
|
391
|
+
var descriptor = props[i];
|
392
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
393
|
+
descriptor.configurable = true;
|
394
|
+
if ("value" in descriptor) descriptor.writable = true;
|
395
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
396
|
+
}
|
415
397
|
}
|
416
|
-
};
|
417
398
|
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
399
|
+
return function (Constructor, protoProps, staticProps) {
|
400
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
401
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
402
|
+
return Constructor;
|
403
|
+
};
|
404
|
+
}();
|
422
405
|
|
423
|
-
ClipboardAction
|
424
|
-
|
406
|
+
var ClipboardAction = function () {
|
407
|
+
/**
|
408
|
+
* @param {Object} options
|
409
|
+
*/
|
425
410
|
|
426
|
-
|
411
|
+
function ClipboardAction(options) {
|
412
|
+
_classCallCheck(this, ClipboardAction);
|
427
413
|
|
428
|
-
|
414
|
+
this.resolveOptions(options);
|
415
|
+
this.initSelection();
|
416
|
+
}
|
429
417
|
|
430
|
-
|
431
|
-
|
432
|
-
|
418
|
+
/**
|
419
|
+
* Defines base properties passed from constructor.
|
420
|
+
* @param {Object} options
|
421
|
+
*/
|
433
422
|
|
434
|
-
this.fakeElem = document.createElement('textarea');
|
435
|
-
// Prevent zooming on iOS
|
436
|
-
this.fakeElem.style.fontSize = '12pt';
|
437
|
-
// Reset box model
|
438
|
-
this.fakeElem.style.border = '0';
|
439
|
-
this.fakeElem.style.padding = '0';
|
440
|
-
this.fakeElem.style.margin = '0';
|
441
|
-
// Move element out of screen horizontally
|
442
|
-
this.fakeElem.style.position = 'absolute';
|
443
|
-
this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
|
444
|
-
// Move element to the same position vertically
|
445
|
-
this.fakeElem.style.top = (window.pageYOffset || document.documentElement.scrollTop) + 'px';
|
446
|
-
this.fakeElem.setAttribute('readonly', '');
|
447
|
-
this.fakeElem.value = this.text;
|
448
|
-
|
449
|
-
document.body.appendChild(this.fakeElem);
|
450
|
-
|
451
|
-
this.selectedText = _select2['default'](this.fakeElem);
|
452
|
-
this.copyText();
|
453
|
-
};
|
454
423
|
|
455
|
-
|
456
|
-
|
457
|
-
* a user can hit `Ctrl+C` to copy because selection still exists.
|
458
|
-
*/
|
424
|
+
ClipboardAction.prototype.resolveOptions = function resolveOptions() {
|
425
|
+
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
459
426
|
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
this.
|
464
|
-
|
427
|
+
this.action = options.action;
|
428
|
+
this.emitter = options.emitter;
|
429
|
+
this.target = options.target;
|
430
|
+
this.text = options.text;
|
431
|
+
this.trigger = options.trigger;
|
465
432
|
|
466
|
-
|
467
|
-
|
468
|
-
this.fakeElem = null;
|
469
|
-
}
|
470
|
-
};
|
433
|
+
this.selectedText = '';
|
434
|
+
};
|
471
435
|
|
472
|
-
|
473
|
-
|
474
|
-
|
436
|
+
ClipboardAction.prototype.initSelection = function initSelection() {
|
437
|
+
if (this.text && this.target) {
|
438
|
+
throw new Error('Multiple attributes declared, use either "target" or "text"');
|
439
|
+
} else if (this.text) {
|
440
|
+
this.selectFake();
|
441
|
+
} else if (this.target) {
|
442
|
+
this.selectTarget();
|
443
|
+
} else {
|
444
|
+
throw new Error('Missing required attributes, use either "target" or "text"');
|
445
|
+
}
|
446
|
+
};
|
475
447
|
|
476
|
-
|
477
|
-
|
478
|
-
this.copyText();
|
479
|
-
};
|
448
|
+
ClipboardAction.prototype.selectFake = function selectFake() {
|
449
|
+
var _this = this;
|
480
450
|
|
481
|
-
|
482
|
-
* Executes the copy operation based on the current selection.
|
483
|
-
*/
|
451
|
+
var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
|
484
452
|
|
485
|
-
|
486
|
-
var succeeded = undefined;
|
453
|
+
this.removeFake();
|
487
454
|
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
succeeded = false;
|
492
|
-
}
|
455
|
+
this.fakeHandler = document.body.addEventListener('click', function () {
|
456
|
+
return _this.removeFake();
|
457
|
+
});
|
493
458
|
|
494
|
-
|
495
|
-
|
459
|
+
this.fakeElem = document.createElement('textarea');
|
460
|
+
// Prevent zooming on iOS
|
461
|
+
this.fakeElem.style.fontSize = '12pt';
|
462
|
+
// Reset box model
|
463
|
+
this.fakeElem.style.border = '0';
|
464
|
+
this.fakeElem.style.padding = '0';
|
465
|
+
this.fakeElem.style.margin = '0';
|
466
|
+
// Move element out of screen horizontally
|
467
|
+
this.fakeElem.style.position = 'fixed';
|
468
|
+
this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
|
469
|
+
// Move element to the same position vertically
|
470
|
+
this.fakeElem.style.top = (window.pageYOffset || document.documentElement.scrollTop) + 'px';
|
471
|
+
this.fakeElem.setAttribute('readonly', '');
|
472
|
+
this.fakeElem.value = this.text;
|
473
|
+
|
474
|
+
document.body.appendChild(this.fakeElem);
|
475
|
+
|
476
|
+
this.selectedText = (0, _select2.default)(this.fakeElem);
|
477
|
+
this.copyText();
|
478
|
+
};
|
479
|
+
|
480
|
+
ClipboardAction.prototype.removeFake = function removeFake() {
|
481
|
+
if (this.fakeHandler) {
|
482
|
+
document.body.removeEventListener('click');
|
483
|
+
this.fakeHandler = null;
|
484
|
+
}
|
496
485
|
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
486
|
+
if (this.fakeElem) {
|
487
|
+
document.body.removeChild(this.fakeElem);
|
488
|
+
this.fakeElem = null;
|
489
|
+
}
|
490
|
+
};
|
501
491
|
|
502
|
-
|
503
|
-
|
504
|
-
this.
|
505
|
-
|
506
|
-
text: this.selectedText,
|
507
|
-
trigger: this.trigger,
|
508
|
-
clearSelection: this.clearSelection.bind(this)
|
509
|
-
});
|
510
|
-
} else {
|
511
|
-
this.emitter.emit('error', {
|
512
|
-
action: this.action,
|
513
|
-
trigger: this.trigger,
|
514
|
-
clearSelection: this.clearSelection.bind(this)
|
515
|
-
});
|
516
|
-
}
|
517
|
-
};
|
492
|
+
ClipboardAction.prototype.selectTarget = function selectTarget() {
|
493
|
+
this.selectedText = (0, _select2.default)(this.target);
|
494
|
+
this.copyText();
|
495
|
+
};
|
518
496
|
|
519
|
-
|
520
|
-
|
521
|
-
*/
|
497
|
+
ClipboardAction.prototype.copyText = function copyText() {
|
498
|
+
var succeeded = undefined;
|
522
499
|
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
500
|
+
try {
|
501
|
+
succeeded = document.execCommand(this.action);
|
502
|
+
} catch (err) {
|
503
|
+
succeeded = false;
|
504
|
+
}
|
527
505
|
|
528
|
-
|
529
|
-
|
506
|
+
this.handleResult(succeeded);
|
507
|
+
};
|
508
|
+
|
509
|
+
ClipboardAction.prototype.handleResult = function handleResult(succeeded) {
|
510
|
+
if (succeeded) {
|
511
|
+
this.emitter.emit('success', {
|
512
|
+
action: this.action,
|
513
|
+
text: this.selectedText,
|
514
|
+
trigger: this.trigger,
|
515
|
+
clearSelection: this.clearSelection.bind(this)
|
516
|
+
});
|
517
|
+
} else {
|
518
|
+
this.emitter.emit('error', {
|
519
|
+
action: this.action,
|
520
|
+
trigger: this.trigger,
|
521
|
+
clearSelection: this.clearSelection.bind(this)
|
522
|
+
});
|
523
|
+
}
|
524
|
+
};
|
530
525
|
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
526
|
+
ClipboardAction.prototype.clearSelection = function clearSelection() {
|
527
|
+
if (this.target) {
|
528
|
+
this.target.blur();
|
529
|
+
}
|
535
530
|
|
536
|
-
|
537
|
-
|
538
|
-
*/
|
531
|
+
window.getSelection().removeAllRanges();
|
532
|
+
};
|
539
533
|
|
540
|
-
|
541
|
-
|
542
|
-
|
534
|
+
ClipboardAction.prototype.destroy = function destroy() {
|
535
|
+
this.removeFake();
|
536
|
+
};
|
543
537
|
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
538
|
+
_createClass(ClipboardAction, [{
|
539
|
+
key: 'action',
|
540
|
+
set: function set() {
|
541
|
+
var action = arguments.length <= 0 || arguments[0] === undefined ? 'copy' : arguments[0];
|
548
542
|
|
549
|
-
|
543
|
+
this._action = action;
|
550
544
|
|
551
|
-
|
552
|
-
|
545
|
+
if (this._action !== 'copy' && this._action !== 'cut') {
|
546
|
+
throw new Error('Invalid "action" value, use either "copy" or "cut"');
|
547
|
+
}
|
548
|
+
},
|
549
|
+
get: function get() {
|
550
|
+
return this._action;
|
553
551
|
}
|
554
|
-
},
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
/**
|
565
|
-
* Sets the `target` property using an element
|
566
|
-
* that will be have its content copied.
|
567
|
-
* @param {Element} target
|
568
|
-
*/
|
569
|
-
}, {
|
570
|
-
key: 'target',
|
571
|
-
set: function set(target) {
|
572
|
-
if (target !== undefined) {
|
573
|
-
if (target && typeof target === 'object' && target.nodeType === 1) {
|
574
|
-
this._target = target;
|
575
|
-
} else {
|
576
|
-
throw new Error('Invalid "target" value, use a valid Element');
|
552
|
+
}, {
|
553
|
+
key: 'target',
|
554
|
+
set: function set(target) {
|
555
|
+
if (target !== undefined) {
|
556
|
+
if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
|
557
|
+
this._target = target;
|
558
|
+
} else {
|
559
|
+
throw new Error('Invalid "target" value, use a valid Element');
|
560
|
+
}
|
577
561
|
}
|
562
|
+
},
|
563
|
+
get: function get() {
|
564
|
+
return this._target;
|
578
565
|
}
|
579
|
-
}
|
566
|
+
}]);
|
580
567
|
|
581
|
-
|
582
|
-
|
583
|
-
* @return {String|HTMLElement}
|
584
|
-
*/
|
585
|
-
get: function get() {
|
586
|
-
return this._target;
|
587
|
-
}
|
588
|
-
}]);
|
589
|
-
|
590
|
-
return ClipboardAction;
|
591
|
-
})();
|
568
|
+
return ClipboardAction;
|
569
|
+
}();
|
592
570
|
|
593
|
-
exports
|
594
|
-
|
571
|
+
module.exports = ClipboardAction;
|
572
|
+
});
|
595
573
|
|
596
574
|
},{"select":6}],9:[function(require,module,exports){
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
575
|
+
(function (global, factory) {
|
576
|
+
if (typeof define === "function" && define.amd) {
|
577
|
+
define(['module', './clipboard-action', 'tiny-emitter', 'good-listener'], factory);
|
578
|
+
} else if (typeof exports !== "undefined") {
|
579
|
+
factory(module, require('./clipboard-action'), require('tiny-emitter'), require('good-listener'));
|
580
|
+
} else {
|
581
|
+
var mod = {
|
582
|
+
exports: {}
|
583
|
+
};
|
584
|
+
factory(mod, global.clipboardAction, global.tinyEmitter, global.goodListener);
|
585
|
+
global.clipboard = mod.exports;
|
586
|
+
}
|
587
|
+
})(this, function (module, _clipboardAction, _tinyEmitter, _goodListener) {
|
588
|
+
'use strict';
|
606
589
|
|
607
|
-
var
|
590
|
+
var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
|
608
591
|
|
609
|
-
var
|
592
|
+
var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
|
610
593
|
|
611
|
-
var
|
594
|
+
var _goodListener2 = _interopRequireDefault(_goodListener);
|
612
595
|
|
613
|
-
|
596
|
+
function _interopRequireDefault(obj) {
|
597
|
+
return obj && obj.__esModule ? obj : {
|
598
|
+
default: obj
|
599
|
+
};
|
600
|
+
}
|
614
601
|
|
615
|
-
|
602
|
+
function _classCallCheck(instance, Constructor) {
|
603
|
+
if (!(instance instanceof Constructor)) {
|
604
|
+
throw new TypeError("Cannot call a class as a function");
|
605
|
+
}
|
606
|
+
}
|
616
607
|
|
617
|
-
|
608
|
+
function _possibleConstructorReturn(self, call) {
|
609
|
+
if (!self) {
|
610
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
611
|
+
}
|
618
612
|
|
619
|
-
|
620
|
-
|
621
|
-
* and instantiates a new `ClipboardAction` on each click.
|
622
|
-
*/
|
613
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
614
|
+
}
|
623
615
|
|
624
|
-
|
625
|
-
|
616
|
+
function _inherits(subClass, superClass) {
|
617
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
618
|
+
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
619
|
+
}
|
626
620
|
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
621
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
622
|
+
constructor: {
|
623
|
+
value: subClass,
|
624
|
+
enumerable: false,
|
625
|
+
writable: true,
|
626
|
+
configurable: true
|
627
|
+
}
|
628
|
+
});
|
629
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
630
|
+
}
|
631
631
|
|
632
|
-
function
|
633
|
-
|
632
|
+
var Clipboard = function (_Emitter) {
|
633
|
+
_inherits(Clipboard, _Emitter);
|
634
634
|
|
635
|
-
|
635
|
+
/**
|
636
|
+
* @param {String|HTMLElement|HTMLCollection|NodeList} trigger
|
637
|
+
* @param {Object} options
|
638
|
+
*/
|
636
639
|
|
637
|
-
|
638
|
-
|
639
|
-
}
|
640
|
+
function Clipboard(trigger, options) {
|
641
|
+
_classCallCheck(this, Clipboard);
|
640
642
|
|
641
|
-
|
642
|
-
* Helper function to retrieve attribute value.
|
643
|
-
* @param {String} suffix
|
644
|
-
* @param {Element} element
|
645
|
-
*/
|
643
|
+
var _this = _possibleConstructorReturn(this, _Emitter.call(this));
|
646
644
|
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
*/
|
645
|
+
_this.resolveOptions(options);
|
646
|
+
_this.listenClick(trigger);
|
647
|
+
return _this;
|
648
|
+
}
|
652
649
|
|
653
|
-
|
654
|
-
|
650
|
+
/**
|
651
|
+
* Defines if attributes would be resolved using internal setter functions
|
652
|
+
* or custom functions that were passed in the constructor.
|
653
|
+
* @param {Object} options
|
654
|
+
*/
|
655
655
|
|
656
|
-
this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
|
657
|
-
this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
|
658
|
-
this.text = typeof options.text === 'function' ? options.text : this.defaultText;
|
659
|
-
};
|
660
656
|
|
661
|
-
|
662
|
-
|
663
|
-
* @param {String|HTMLElement|HTMLCollection|NodeList} trigger
|
664
|
-
*/
|
657
|
+
Clipboard.prototype.resolveOptions = function resolveOptions() {
|
658
|
+
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
665
659
|
|
666
|
-
|
667
|
-
|
660
|
+
this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
|
661
|
+
this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
|
662
|
+
this.text = typeof options.text === 'function' ? options.text : this.defaultText;
|
663
|
+
};
|
668
664
|
|
669
|
-
|
670
|
-
|
671
|
-
});
|
672
|
-
};
|
665
|
+
Clipboard.prototype.listenClick = function listenClick(trigger) {
|
666
|
+
var _this2 = this;
|
673
667
|
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
668
|
+
this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
|
669
|
+
return _this2.onClick(e);
|
670
|
+
});
|
671
|
+
};
|
678
672
|
|
679
|
-
|
680
|
-
|
673
|
+
Clipboard.prototype.onClick = function onClick(e) {
|
674
|
+
var trigger = e.delegateTarget || e.currentTarget;
|
681
675
|
|
682
|
-
|
683
|
-
|
684
|
-
|
676
|
+
if (this.clipboardAction) {
|
677
|
+
this.clipboardAction = null;
|
678
|
+
}
|
685
679
|
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
680
|
+
this.clipboardAction = new _clipboardAction2.default({
|
681
|
+
action: this.action(trigger),
|
682
|
+
target: this.target(trigger),
|
683
|
+
text: this.text(trigger),
|
684
|
+
trigger: trigger,
|
685
|
+
emitter: this
|
686
|
+
});
|
687
|
+
};
|
694
688
|
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
*/
|
689
|
+
Clipboard.prototype.defaultAction = function defaultAction(trigger) {
|
690
|
+
return getAttributeValue('action', trigger);
|
691
|
+
};
|
699
692
|
|
700
|
-
|
701
|
-
|
702
|
-
};
|
693
|
+
Clipboard.prototype.defaultTarget = function defaultTarget(trigger) {
|
694
|
+
var selector = getAttributeValue('target', trigger);
|
703
695
|
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
696
|
+
if (selector) {
|
697
|
+
return document.querySelector(selector);
|
698
|
+
}
|
699
|
+
};
|
708
700
|
|
709
|
-
|
710
|
-
|
701
|
+
Clipboard.prototype.defaultText = function defaultText(trigger) {
|
702
|
+
return getAttributeValue('text', trigger);
|
703
|
+
};
|
711
704
|
|
712
|
-
|
713
|
-
|
714
|
-
}
|
715
|
-
};
|
705
|
+
Clipboard.prototype.destroy = function destroy() {
|
706
|
+
this.listener.destroy();
|
716
707
|
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
708
|
+
if (this.clipboardAction) {
|
709
|
+
this.clipboardAction.destroy();
|
710
|
+
this.clipboardAction = null;
|
711
|
+
}
|
712
|
+
};
|
721
713
|
|
722
|
-
|
723
|
-
|
724
|
-
};
|
714
|
+
return Clipboard;
|
715
|
+
}(_tinyEmitter2.default);
|
725
716
|
|
726
717
|
/**
|
727
|
-
*
|
718
|
+
* Helper function to retrieve attribute value.
|
719
|
+
* @param {String} suffix
|
720
|
+
* @param {Element} element
|
728
721
|
*/
|
722
|
+
function getAttributeValue(suffix, element) {
|
723
|
+
var attribute = 'data-clipboard-' + suffix;
|
729
724
|
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
if (this.clipboardAction) {
|
734
|
-
this.clipboardAction.destroy();
|
735
|
-
this.clipboardAction = null;
|
725
|
+
if (!element.hasAttribute(attribute)) {
|
726
|
+
return;
|
736
727
|
}
|
737
|
-
};
|
738
|
-
|
739
|
-
return Clipboard;
|
740
|
-
})(_tinyEmitter2['default']);
|
741
728
|
|
742
|
-
|
743
|
-
function getAttributeValue(suffix, element) {
|
744
|
-
var attribute = 'data-clipboard-' + suffix;
|
745
|
-
|
746
|
-
if (!element.hasAttribute(attribute)) {
|
747
|
-
return;
|
729
|
+
return element.getAttribute(attribute);
|
748
730
|
}
|
749
731
|
|
750
|
-
|
751
|
-
}
|
752
|
-
module.exports = exports['default'];
|
732
|
+
module.exports = Clipboard;
|
733
|
+
});
|
753
734
|
|
754
735
|
},{"./clipboard-action":8,"good-listener":4,"tiny-emitter":7}]},{},[9])(9)
|
755
|
-
});
|
736
|
+
});
|
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.9
|
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-
|
11
|
+
date: 2016-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -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: ''
|