Skip to content

Commit 4d675a2

Browse files
committed
fix broken getClipboard #21
1 parent 1369bce commit 4d675a2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Diff for: send.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,14 @@
3636
if (!document.activeElement) {
3737
throw new Error("`document.activeElement` is null");
3838
}
39-
document.activeElement.appendChild(pasteTarget);
39+
const activeElement = document.activeElement.appendChild(pasteTarget).parentNode;
4040
pasteTarget.focus();
4141
document.execCommand("Paste");
4242
const paste = pasteTarget.innerText;
43-
document.activeElement.removeChild(pasteTarget);
43+
if (!activeElement) {
44+
throw new Error("`activeElement` is null")
45+
}
46+
activeElement.removeChild(pasteTarget);
4447
return paste;
4548
};
4649

0 commit comments

Comments
 (0)