From 1c7c478a4a3c57b39e16f14016eca52891d8d26b Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Thu, 9 Jun 2022 20:58:52 +0200 Subject: [PATCH] fix: Newlines should be interpreted as paragraphs when pasting closes #3421 --- shared/editor/plugins/PasteHandler.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shared/editor/plugins/PasteHandler.ts b/shared/editor/plugins/PasteHandler.ts index 5d8f1d6e2..f759c7a8f 100644 --- a/shared/editor/plugins/PasteHandler.ts +++ b/shared/editor/plugins/PasteHandler.ts @@ -30,6 +30,9 @@ function normalizePastedMarkdown(text: string): string { // find multiple newlines and insert a hard break to ensure they are respected text = text.replace(/\n{2,}/g, "\n\n\\\n"); + // find single newlines and insert an extra to ensure they are treated as paragraphs + text = text.replace(/\b\n\b/g, "\n\n"); + return text; }