Skip to content

Fix: Preserve multiple consecutive newlines in TipTap editor#4

Open
AJ-505 wants to merge 1 commit intoyemisi567:masterfrom
AJ-505:fix/newline-collapsing
Open

Fix: Preserve multiple consecutive newlines in TipTap editor#4
AJ-505 wants to merge 1 commit intoyemisi567:masterfrom
AJ-505:fix/newline-collapsing

Conversation

@AJ-505
Copy link
Copy Markdown
Contributor

@AJ-505 AJ-505 commented Oct 8, 2025

Fix: Multiple Newlines Collapsing to Single Line

Issue

When users pressed Enter multiple times to create blank lines, only one blank line would remain after typing resumed. Multiple consecutive newlines were being collapsed into a single newline.

Root Cause

The TipTapWrapper.tsx HTML-to-blocks conversion was filtering out empty <p> elements:

// Previous code - filtered out empty paragraphs
if (content && content.trim().length > 0) {
  blocks.push({...});
}

This caused all empty paragraph nodes to be removed during the conversion process, collapsing multiple newlines.

Solution

  1. HTML-to-blocks conversion: Modified to always preserve paragraph blocks, even when empty
  2. Enhanced CSS: Improved empty paragraph handling with inline-block zero-width space and explicit sizing

Changes Made

  • src/components/Editor/TipTapWrapper.tsx: Remove empty content filter for paragraphs
  • src/index.css: Enhanced empty paragraph CSS rules

@netlify
Copy link
Copy Markdown

netlify bot commented Oct 8, 2025

👷 Deploy request for writeflow-app pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 844ee7f

@vercel
Copy link
Copy Markdown

vercel bot commented Oct 8, 2025

@AJ-505 is attempting to deploy a commit to the alegbeyemigmailcom's projects Team on Vercel.

A member of the Team first needs to authorize it.

@netlify
Copy link
Copy Markdown

netlify bot commented Oct 8, 2025

Deploy Preview for yemisienyata failed. Why did it fail? →

Name Link
🔨 Latest commit 844ee7f
🔍 Latest deploy log https://app.netlify.com/projects/yemisienyata/deploys/68e6a4e9e946c30007b5adb8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant