mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
Updates delegate package which now exposes e.delegateTarget property #120
This commit is contained in:
parent
5efcdf2810
commit
cb4301658c
@ -6,7 +6,9 @@
|
||||
</head>
|
||||
<body>
|
||||
<!-- 1. Define some markup -->
|
||||
<button id="btn" data-clipboard-text="1">Copy</button>
|
||||
<div id="btn" data-clipboard-text="1">
|
||||
<span>Copy</span>
|
||||
</div>
|
||||
|
||||
<!-- 2. Include library -->
|
||||
<script src="../dist/clipboard.min.js"></script>
|
||||
|
@ -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"
|
||||
},
|
||||
|
@ -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
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user