diff --git a/demo/constructor-node.html b/demo/constructor-node.html index f84857a..c118772 100644 --- a/demo/constructor-node.html +++ b/demo/constructor-node.html @@ -6,7 +6,9 @@ - +
+ Copy +
diff --git a/package.json b/package.json index 974200c..15e86bd 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "cut" ], "dependencies": { - "good-listener": "^1.1.2", + "good-listener": "^1.1.4", "select": "^1.0.4", "tiny-emitter": "^1.0.0" }, diff --git a/src/clipboard.js b/src/clipboard.js index 1b3a71f..049c235 100644 --- a/src/clipboard.js +++ b/src/clipboard.js @@ -42,15 +42,17 @@ class Clipboard extends Emitter { * @param {Event} e */ onClick(e) { + var trigger = e.delegateTarget || e.currentTarget; + if (this.clipboardAction) { this.clipboardAction = null; } this.clipboardAction = new ClipboardAction({ - action : this.action(e.currentTarget), - target : this.target(e.currentTarget), - text : this.text(e.currentTarget), - trigger : e.currentTarget, + action : this.action(trigger), + target : this.target(trigger), + text : this.text(trigger), + trigger : trigger, emitter : this }); }