From 2acee80829e71157b07be2d5e9526fdcd7c30921 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Wed, 31 Dec 2025 08:22:13 +0100 Subject: [PATCH] fix: normalize Windows CRLF line endings in clipboard text (#20283) On Windows, clipboard text uses CRLF (\r\n) line endings which can cause newlines to be lost or displayed incorrectly when pasted via the {{CLIPBOARD}} variable. Fixed by converting CRLF to LF before inserting clipboard text. Fixes #19370 --- src/lib/components/channel/MessageInput.svelte | 2 +- src/lib/components/chat/MessageInput.svelte | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/components/channel/MessageInput.svelte b/src/lib/components/channel/MessageInput.svelte index f96274113..bff703c51 100644 --- a/src/lib/components/channel/MessageInput.svelte +++ b/src/lib/components/channel/MessageInput.svelte @@ -126,7 +126,7 @@ } } - text = text.replaceAll('{{CLIPBOARD}}', clipboardText); + text = text.replaceAll('{{CLIPBOARD}}', clipboardText.replaceAll('\r\n', '\n')); } if (text.includes('{{USER_LOCATION}}')) { diff --git a/src/lib/components/chat/MessageInput.svelte b/src/lib/components/chat/MessageInput.svelte index ab8abd75f..e2f13538b 100644 --- a/src/lib/components/chat/MessageInput.svelte +++ b/src/lib/components/chat/MessageInput.svelte @@ -200,7 +200,7 @@ } } - text = text.replaceAll('{{CLIPBOARD}}', clipboardText); + text = text.replaceAll('{{CLIPBOARD}}', clipboardText.replaceAll('\r\n', '\n')); } if (text.includes('{{USER_LOCATION}}')) {