From 0c3cc205221727e31e005666486d9f51f802b014 Mon Sep 17 00:00:00 2001 From: Aitor Moreno Date: Mon, 11 Aug 2025 12:32:20 +0200 Subject: [PATCH] :bug: Fix paste error on single line pastes --- .../src/editor/controllers/SelectionController.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/text-editor/src/editor/controllers/SelectionController.js b/frontend/text-editor/src/editor/controllers/SelectionController.js index 7bd693bb22..1aef008821 100644 --- a/frontend/text-editor/src/editor/controllers/SelectionController.js +++ b/frontend/text-editor/src/editor/controllers/SelectionController.js @@ -1057,7 +1057,7 @@ export class SelectionController extends EventTarget { fragment.children.length === 1 && fragment.firstElementChild?.dataset?.inline === "force" ) { - const collapseNode = fragment.lastElementChild.firstChild; + const collapseNode = fragment.lastElementChild.firstChild.firstChild; if (this.isInlineStart) { this.focusInline.before(...fragment.firstElementChild.children); } else if (this.isInlineEnd) { @@ -1382,10 +1382,13 @@ export class SelectionController extends EventTarget { */ insertParagraph() { if (this.isParagraphEnd) { + console.log('a') return this.insertParagraphAfter(); } else if (this.isParagraphStart) { + console.log('b') return this.insertParagraphBefore(); } + console.log('c') return this.splitParagraph(); }