Uses optimistic execCommand and removes redundant logic - Fixes #1

This commit is contained in:
Eduardo Lundgren 2015-09-21 09:49:01 -03:00 committed by Zeno Rocha
parent f3c042a364
commit 23b20d6006

View File

@ -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() {