From 5e3abfab928c8bb5302edcd45da9b09905f5d24c Mon Sep 17 00:00:00 2001 From: Sky Date: Wed, 20 Nov 2024 13:19:13 +0000 Subject: [PATCH] no newline pls --- app/utils.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/utils.ts b/app/utils.ts index 285316f50..e3db9336a 100644 --- a/app/utils.ts +++ b/app/utils.ts @@ -19,7 +19,7 @@ export function trimTopic(topic: string) { } export async function copyToClipboard(text: string) { - const trimmedText = text.trim(); // Remove any leading or trailing whitespace + const trimmedText = text.trim(); // Ensure no extra spaces or newlines try { if (window.__TAURI__) { @@ -31,6 +31,8 @@ export async function copyToClipboard(text: string) { showToast(Locale.Copy.Success); } catch (error) { const textArea = document.createElement("textarea"); + textArea.style.position = 'fixed'; // Avoid scrolling to the bottom + textArea.style.opacity = '0'; // Hide the textarea textArea.value = trimmedText; document.body.appendChild(textArea); textArea.select(); @@ -46,7 +48,6 @@ export async function copyToClipboard(text: string) { } } - export async function downloadAs(text: string, filename: string) { if (window.__TAURI__) { const result = await window.__TAURI__.dialog.save({