From 844ee7f0f1c6677d7bf1d6bc56320ade000c8c4f Mon Sep 17 00:00:00 2001 From: AJ-505 Date: Wed, 8 Oct 2025 18:45:11 +0100 Subject: [PATCH] Fix: Preserve multiple consecutive newlines in TipTap editor --- src/components/Editor/TipTapWrapper.tsx | 15 +++++++-------- src/index.css | 9 ++++++++- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/components/Editor/TipTapWrapper.tsx b/src/components/Editor/TipTapWrapper.tsx index faec5cf..a8aff4d 100644 --- a/src/components/Editor/TipTapWrapper.tsx +++ b/src/components/Editor/TipTapWrapper.tsx @@ -156,14 +156,13 @@ const TipTapWrapper: React.FC = ({ }); break; case "p": - if (content && content.trim().length > 0) { - blocks.push({ - id: `block-${blockId++}`, - type: "text", - content, - htmlContent, - }); - } + // Always preserve paragraph blocks, even if empty (for proper newline handling) + blocks.push({ + id: `block-${blockId++}`, + type: "text", + content: content || "", + htmlContent, + }); break; default: // For other elements, only process if they have meaningful content diff --git a/src/index.css b/src/index.css index 5370420..cfb7cea 100644 --- a/src/index.css +++ b/src/index.css @@ -212,11 +212,18 @@ .ProseMirror p { overflow-wrap: break-word; min-height: 1em; + margin: 0; + padding: 0; + } + + .ProseMirror p:empty { + min-height: 1em; } .ProseMirror p:empty::before { content: '\200B'; - display: inline; + display: inline-block; + width: 0; } .ProseMirror p.is-editor-empty:first-child::before {