From 585eed513572027f59495e8044aca9692a2e97f9 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 13 Jan 2026 19:41:16 +0000 Subject: [PATCH] Preserve newlines when sending chat messages The MentionEditor's serializeContent function was not handling hardBreak nodes created by Shift+Enter. This caused newlines within messages to be lost during serialization, even though the editor displayed them correctly. Changes: - Add hardBreak node handling in serializeContent - Preserve newlines (\n) from Shift+Enter keypresses - Ensure multi-line messages are sent with proper line breaks With this fix and the previous Text.tsx fix, newlines are now properly: 1. Captured when typing (Shift+Enter creates hardBreak) 2. Preserved when sending (hardBreak serialized as \n) 3. Rendered when displaying (Text component renders \n as
) --- src/components/editor/MentionEditor.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/editor/MentionEditor.tsx b/src/components/editor/MentionEditor.tsx index d301565..f597ba7 100644 --- a/src/components/editor/MentionEditor.tsx +++ b/src/components/editor/MentionEditor.tsx @@ -584,6 +584,9 @@ export const MentionEditor = forwardRef< node.content?.forEach((child: any) => { if (child.type === "text") { text += child.text; + } else if (child.type === "hardBreak") { + // Preserve newlines from Shift+Enter + text += "\n"; } else if (child.type === "mention") { const pubkey = child.attrs?.id; if (pubkey) {