Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

compose: Fix bug where extra line breaks were pasted between blocks.

N-Shar-ma6bc909278679
diff --git a/web/src/copy_and_paste.js b/web/src/copy_and_paste.js
index 70ff9e60715..f868632c796 100644
--- a/web/src/copy_and_paste.js
+++ b/web/src/copy_and_paste.js
@@ -337,6 +337,7 @@ export function paste_handler_converter(paste_html) {
emDelimiter: "*",
codeBlockStyle: "fenced",
headingStyle: "atx",
+ br: "",
});
turndownService.addRule("style", {
filter: "style",
diff --git a/web/tests/copy_and_paste.test.js b/web/tests/copy_and_paste.test.js
index 1726522d5ad..37df6a9411c 100644
--- a/web/tests/copy_and_paste.test.js
+++ b/web/tests/copy_and_paste.test.js
@@ -97,6 +97,11 @@ run_test("paste_handler_converter", () => {
"* bulleted\n* nested\n * nested level 1\n * nested level 1 continue\n * nested level 2\n * nested level 2 continue",
);
+ // 2 paragraphs with line break/s in between
+ input =
+ '<meta http-equiv="content-type" content="text/html; charset=utf-8"><p>paragraph 1</p><br><p>paragraph 2</p>';
+ assert.equal(copy_and_paste.paste_handler_converter(input), "paragraph 1\n\nparagraph 2");
+
// Pasting from external sources
// Pasting list from GitHub
input =