Skip to content

Commit

Permalink
fix broken getClipboard #21
Browse files Browse the repository at this point in the history
  • Loading branch information
bootjp committed Mar 30, 2022
1 parent 1369bce commit 4d675a2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions send.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@
if (!document.activeElement) {
throw new Error("`document.activeElement` is null");
}
document.activeElement.appendChild(pasteTarget);
const activeElement = document.activeElement.appendChild(pasteTarget).parentNode;
pasteTarget.focus();
document.execCommand("Paste");
const paste = pasteTarget.innerText;
document.activeElement.removeChild(pasteTarget);
if (!activeElement) {
throw new Error("`activeElement` is null")
}
activeElement.removeChild(pasteTarget);
return paste;
};

Expand Down

0 comments on commit 4d675a2

Please sign in to comment.