feat(client/web): Set clipboard export

This commit is contained in:
Luke
2022-04-17 18:22:19 +02:00
parent e00ef6cbf5
commit 96d1f74f14
3 changed files with 22 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
// yoinked from https://github.com/project-error/npwd/blob/d8dc5b7f47faf5fc581ffee30f31ff61d184cfe7/phone/src/os/phone/hooks/useClipboard.ts#L1
export const setClipboard = (value: string) => {
const clipElem = document.createElement('input');
clipElem.value = value;
document.body.appendChild(clipElem);
clipElem.select();
document.execCommand('copy');
document.body.removeChild(clipElem);
};