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() {
|
copy() {
|
||||||
let supported = document.queryCommandSupported(this.action);
|
let successful = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let successful = document.execCommand(this.action);
|
successful = document.execCommand(this.action);
|
||||||
if (successful) this.fireEventDetails();
|
|
||||||
|
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
supported = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!supported) this.fireNoSupport();
|
if (successful) this.fireEventDetails();
|
||||||
|
else this.fireNoSupport();
|
||||||
}
|
}
|
||||||
|
|
||||||
clearSelection() {
|
clearSelection() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user