mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
Uses optimistic execCommand and removes redundant logic - Fixes #1
This commit is contained in:
parent
f3c042a364
commit
23b20d6006
@ -89,19 +89,17 @@ class ClipboardAction {
|
||||
}
|
||||
|
||||
copy() {
|
||||
let supported = document.queryCommandSupported(this.action);
|
||||
let successful = false;
|
||||
|
||||
try {
|
||||
let successful = document.execCommand(this.action);
|
||||
if (successful) this.fireEventDetails();
|
||||
|
||||
successful = document.execCommand(this.action);
|
||||
this.clearSelection();
|
||||
}
|
||||
catch (err) {
|
||||
supported = false;
|
||||
}
|
||||
|
||||
if (!supported) this.fireNoSupport();
|
||||
if (successful) this.fireEventDetails();
|
||||
else this.fireNoSupport();
|
||||
}
|
||||
|
||||
clearSelection() {
|
||||
|
Loading…
Reference in New Issue
Block a user