mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
feat(client/web): Set clipboard export
This commit is contained in:
9
web/src/utils/setClipboard.ts
Normal file
9
web/src/utils/setClipboard.ts
Normal 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);
|
||||
};
|
||||
Reference in New Issue
Block a user