From 1f2e36774e899c6ec2b3b5f21c51b0f2fa85f7e1 Mon Sep 17 00:00:00 2001 From: Aitor Moreno Date: Tue, 4 Feb 2025 15:54:17 +0100 Subject: [PATCH] :bug: Fix pasting adds a newline (#5763) --- .../src/editor/controllers/SelectionController.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/text-editor/src/editor/controllers/SelectionController.js b/frontend/text-editor/src/editor/controllers/SelectionController.js index fbc2d263b..dd0104855 100644 --- a/frontend/text-editor/src/editor/controllers/SelectionController.js +++ b/frontend/text-editor/src/editor/controllers/SelectionController.js @@ -1066,9 +1066,15 @@ export class SelectionController extends EventTarget { } const collapseNode = fragment.lastElementChild.lastElementChild.firstChild if (this.isParagraphStart) { + const a = fragment.lastElementChild; + const b = this.focusParagraph; this.focusParagraph.before(fragment); + mergeParagraphs(a, b); } else if (this.isParagraphEnd) { + const a = this.focusParagraph; + const b = fragment.firstElementChild; this.focusParagraph.after(fragment); + mergeParagraphs(a, b); } else { const newParagraph = splitParagraph( this.focusParagraph,