clipboard-rails 1.5.1 → 1.5.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 80457eff12874b89ee09a347f0b27096fe149152
4
- data.tar.gz: f8d14f3eaeff6c955092d82cd70eb902a437e0ad
3
+ metadata.gz: 770b1fd6c1b179dd51d7a970b984447e3711ada7
4
+ data.tar.gz: e38af34f32775f6c4a4a045a1cf5f0a0928d7173
5
5
  SHA512:
6
- metadata.gz: 371701cc6575be2be3fa31a2eb54b84adb3cfad5a710f4501969cc5b4a96ca4364fa462bd59afe00a56fb6ca814e6b670b27d1757e2ccb6b67db35395dfe0cdc
7
- data.tar.gz: d99a12ac57e0f2c9a0b3c9065c2e6b636c81c714346caba3b020937ccefac84f2ac17f86e50ac214d85909ae144c2d6164fc2fa06b0730a1965ce70b50c884d7
6
+ metadata.gz: 8678a124215bbfc16158120b0a1c6fab516550f81a1acc12933424b8b9ea5d782a1590dc1c77bf514c9eede5bbb7aad3dc562b5dda5b3425599efc7eb943d93e
7
+ data.tar.gz: 61009f1be5ad470a8bcda471476c1945e95f77340cf0502ac2835a83f9f094af7501fc0801e5859a207dae137fbbf779186ea950f9559dad152cb02b301a2604
@@ -1,5 +1,5 @@
1
1
  module Clipboard
2
2
  module Rails
3
- VERSION = "1.5.1"
3
+ VERSION = "1.5.5"
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * clipboard.js v1.5.1
2
+ * clipboard.js v1.5.5
3
3
  * https://zenorocha.github.io/clipboard.js
4
4
  *
5
5
  * Licensed MIT © Zeno Rocha
@@ -92,13 +92,9 @@ function delegate(element, selector, type, callback) {
92
92
  */
93
93
  function listener(element, selector, type, callback) {
94
94
  return function(e) {
95
- var delegateTarget = closest(e.target, selector, true);
96
-
97
- if (delegateTarget) {
98
- Object.defineProperty(e, 'target', {
99
- value: delegateTarget
100
- });
95
+ e.delegateTarget = closest(e.target, selector, true);
101
96
 
97
+ if (e.delegateTarget) {
102
98
  callback.call(element, e);
103
99
  }
104
100
  }
@@ -259,11 +255,16 @@ function select(element) {
259
255
  var selectedText;
260
256
 
261
257
  if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
262
- element.select();
258
+ element.focus();
259
+ element.setSelectionRange(0, element.value.length);
263
260
 
264
261
  selectedText = element.value;
265
262
  }
266
263
  else {
264
+ if (element.hasAttribute('contenteditable')) {
265
+ element.focus();
266
+ }
267
+
267
268
  var selection = window.getSelection();
268
269
  var range = document.createRange();
269
270
 
@@ -665,15 +666,17 @@ var Clipboard = (function (_Emitter) {
665
666
  */
666
667
 
667
668
  Clipboard.prototype.onClick = function onClick(e) {
669
+ var trigger = e.delegateTarget || e.currentTarget;
670
+
668
671
  if (this.clipboardAction) {
669
672
  this.clipboardAction = null;
670
673
  }
671
674
 
672
675
  this.clipboardAction = new _clipboardAction2['default']({
673
- action: this.action(e.target),
674
- target: this.target(e.target),
675
- text: this.text(e.target),
676
- trigger: e.target,
676
+ action: this.action(trigger),
677
+ target: this.target(trigger),
678
+ text: this.text(trigger),
679
+ trigger: trigger,
677
680
  emitter: this
678
681
  });
679
682
  };
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.1
4
+ version: 1.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mohammed Sadiq
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-27 00:00:00.000000000 Z
11
+ date: 2015-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler