diff --git a/src/components/editor/MentionEditor.tsx b/src/components/editor/MentionEditor.tsx index b8f5428..71c4a80 100644 --- a/src/components/editor/MentionEditor.tsx +++ b/src/components/editor/MentionEditor.tsx @@ -966,7 +966,7 @@ export const MentionEditor = forwardRef< () => ({ focus: () => editor?.commands.focus(), clear: () => editor?.commands.clearContent(), - getContent: () => editor?.getText() || "", + getContent: () => editor?.getText({ blockSeparator: "\n" }) || "", getSerializedContent: () => { if (!editor) return { diff --git a/src/components/editor/RichEditor.tsx b/src/components/editor/RichEditor.tsx index 8839ea3..e315d2d 100644 --- a/src/components/editor/RichEditor.tsx +++ b/src/components/editor/RichEditor.tsx @@ -172,8 +172,9 @@ function serializeContent(editor: any): SerializedContent { const seenBlobs = new Set(); const seenAddrs = new Set(); - // Get plain text representation - const text = editor.getText(); + // Get plain text representation with single newline between blocks + // (TipTap's default is double newline which adds extra blank lines) + const text = editor.getText({ blockSeparator: "\n" }); // Walk the document to collect emoji, blob, and address reference data editor.state.doc.descendants((node: any) => { @@ -533,7 +534,7 @@ export const RichEditor = forwardRef( () => ({ focus: () => editor?.commands.focus(), clear: () => editor?.commands.clearContent(), - getContent: () => editor?.getText() || "", + getContent: () => editor?.getText({ blockSeparator: "\n" }) || "", getSerializedContent: () => { if (!editor) return {