mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
Clears selection only if operation succeeded
This commit is contained in:
@ -98,16 +98,17 @@ class ClipboardAction {
|
||||
succeeded = false;
|
||||
}
|
||||
|
||||
this.fireResult(succeeded);
|
||||
this.clearSelection();
|
||||
this.handleResult(succeeded);
|
||||
}
|
||||
|
||||
fireResult(succeeded) {
|
||||
handleResult(succeeded) {
|
||||
if (succeeded) {
|
||||
this.fireEvent('success', {
|
||||
action: this.action,
|
||||
text: this.selectedText
|
||||
});
|
||||
|
||||
this.clearSelection();
|
||||
}
|
||||
else {
|
||||
this.fireEvent('error', `Cannot execute ${this.action} operation`);
|
||||
|
Reference in New Issue
Block a user