mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
Fix Event API. Update demos. Update tests (#793)
This commit is contained in:
@ -69,17 +69,18 @@ class Clipboard extends Emitter {
|
||||
*/
|
||||
onClick(e) {
|
||||
const trigger = e.delegateTarget || e.currentTarget;
|
||||
const selectedText = ClipboardActionDefault({
|
||||
action: this.action(trigger),
|
||||
const action = this.action(trigger) || 'copy';
|
||||
const text = ClipboardActionDefault({
|
||||
action,
|
||||
container: this.container,
|
||||
target: this.target(trigger),
|
||||
text: this.text(trigger),
|
||||
});
|
||||
|
||||
// Fires an event based on the copy operation result.
|
||||
this.emit(selectedText ? 'success' : 'error', {
|
||||
action: this.action,
|
||||
text: selectedText,
|
||||
this.emit(text ? 'success' : 'error', {
|
||||
action,
|
||||
text,
|
||||
trigger,
|
||||
clearSelection() {
|
||||
if (trigger) {
|
||||
|
Reference in New Issue
Block a user