Skip to content

fix(composer): Fix paragraph breaks getting lost on paste and sending#12915

Open
jancborchardt wants to merge 1 commit into
mainfrom
fix/composer-paste-newlines
Open

fix(composer): Fix paragraph breaks getting lost on paste and sending#12915
jancborchardt wants to merge 1 commit into
mainfrom
fix/composer-paste-newlines

Conversation

@jancborchardt
Copy link
Copy Markdown
Member

In the mail composer (when writing a new mail), pasting plain text content from elsewhere like a local text editor or a website doesn’t preserve empty lines inbetween lines of text or paragraphs. Currently they are removed on pasting, but of course they should be kept.
This happens in both plain-text composing as well as when using formatting.

As an example, this text:

Testing testing
This is second line

Here is another paragraph


And another paragraph

Is being pasted wrongly and appears like this:

Testing testing
This is second line
Here is another paragraph

And another paragraph

Interestingly, when copying the block of text back from the composer into the text editor, it looks fine. So it seems to have been partly a formatting/CSS issue only but the structure was correctly preserved.

Screenshots of:

  • Composer on pasting
  • Received plaintext mail
  • Received HTML mail
Before After
Screenshot From 2026-05-11 13-06-12 Screenshot From 2026-05-11 12-55-02
Screenshot From 2026-05-11 13-07-23 Screenshot From 2026-05-11 12-55-14
Screenshot From 2026-05-11 13-07-43 Screenshot From 2026-05-11 12-55-19

  1. src/components/TextEditor.vue: Visual fix (editor) Added a CSS rule so consecutive <p> elements render with visible spacing:
 :deep(p + p) { margin-top: 1em !important; }
  1. src/util/text.js: Plain-text sending fix Added a customParagraph formatter for <p> that emits two line breaks (\n\n) instead of one, so paragraph breaks are preserved in sent plain-text emails.

  2. lib/Service/MimeMessage.php: HTML→plain-text conversion fix Removed htmlToTextCallback, which was intentionally overriding Horde's default to collapse <p> to \n. Horde's default (\n\n) is now used.

  3. src/ckeditor/mail/MailPlugin.js: HTML mail fix (deleted) This plugin injected style="margin:0;" onto every <p> in the serialized HTML, which overrode email client rendering and collapsed paragraph spacing in received HTML emails. Deleted entirely.

  4. Tests updated

  • src/tests/unit/util/text.spec.js: updated expectations for <p> producing \n\n
  • src/tests/unit/components/MailPlugin.spec.js: deleted (plugin gone)
  • src/tests/unit/components/TextEditor.spec.js: updated to reflect no inline margin styles on <p>

AI-assisted: GitHub Copilot (Claude Sonnet 4.6)

AI-assisted: GitHub Copilot (Claude Sonnet 4.6)
Signed-off-by: Jan C. Borchardt <925062+jancborchardt@users.noreply.github.com>
@jancborchardt jancborchardt self-assigned this May 11, 2026
@jancborchardt jancborchardt added 3. to review design papercut Annoying recurring issue with possibly simple fix. feature:composer labels May 11, 2026
@jancborchardt jancborchardt moved this to 🏗️ At engineering in 🖍 Design team May 11, 2026
}

// Show empty lines correctly in composer
:deep(p + p) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will only fix it in the editor, not for the sent email, no?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this part specifically is to fix the appearance when pasted into the composer (both plaintext and HTML), as without it it looks like the "before" pics. Just verified and tested again, removing that line specifically.

I started with only that CSS part, but that wasn’t enough to fix the issue. So the rest is to make it actually work during the mail sending process.

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

Labels

3. to review bug design feature:composer papercut Annoying recurring issue with possibly simple fix.

Projects

Status: 🏗️ At engineering

Development

Successfully merging this pull request may close these issues.

2 participants