summaryrefslogtreecommitdiff
path: root/src/utils/clipboardUtils.ts
diff options
context:
space:
mode:
authorKurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com>2025-10-21 23:54:40 -0400
committerGitHub <noreply@github.com>2025-10-21 23:54:40 -0400
commit7e6d29d9cb731d2648399282be87adb98e183084 (patch)
tree58db3626b3678546e5cb1c4de9bcfc627fde46c7 /src/utils/clipboardUtils.ts
parent7b5f3cb8b3d17ad125d2f40a58fbba80e863d703 (diff)
parent192716ecfd85199f2d5704314eb7873635d190e9 (diff)
downloaddecky-lsfg-vk-7e6d29d9cb731d2648399282be87adb98e183084.tar.gz
decky-lsfg-vk-7e6d29d9cb731d2648399282be87adb98e183084.zip
Merge pull request #190 from xXJSONDeruloXx/cleanup-miscv0.12.1
More cleanup
Diffstat (limited to 'src/utils/clipboardUtils.ts')
-rw-r--r--src/utils/clipboardUtils.ts6
1 files changed, 0 insertions, 6 deletions
diff --git a/src/utils/clipboardUtils.ts b/src/utils/clipboardUtils.ts
index 2d480fc..8a04caa 100644
--- a/src/utils/clipboardUtils.ts
+++ b/src/utils/clipboardUtils.ts
@@ -7,7 +7,6 @@
* This is especially important in gaming mode where clipboard APIs may behave differently
*/
export async function copyToClipboard(text: string): Promise<boolean> {
- // Use the proven input simulation method
const tempInput = document.createElement('input');
tempInput.value = text;
tempInput.style.position = 'absolute';
@@ -15,18 +14,15 @@ export async function copyToClipboard(text: string): Promise<boolean> {
document.body.appendChild(tempInput);
try {
- // Focus and select the text
tempInput.focus();
tempInput.select();
- // Try copying using execCommand first (most reliable in gaming mode)
let copySuccess = false;
try {
if (document.execCommand('copy')) {
copySuccess = true;
}
} catch (e) {
- // If execCommand fails, try navigator.clipboard as fallback
try {
await navigator.clipboard.writeText(text);
copySuccess = true;
@@ -37,7 +33,6 @@ export async function copyToClipboard(text: string): Promise<boolean> {
return copySuccess;
} finally {
- // Clean up
document.body.removeChild(tempInput);
}
}
@@ -50,7 +45,6 @@ export async function verifyCopy(expectedText: string): Promise<boolean> {
const readBack = await navigator.clipboard.readText();
return readBack === expectedText;
} catch (e) {
- // Verification not available, assume success
return true;
}
}