🐛 Fix paste error on single line pastes

This commit is contained in:
Aitor Moreno 2025-08-11 12:32:20 +02:00
parent 99b40cecf2
commit 0c3cc20522

View File

@ -1057,7 +1057,7 @@ export class SelectionController extends EventTarget {
fragment.children.length === 1 && fragment.children.length === 1 &&
fragment.firstElementChild?.dataset?.inline === "force" fragment.firstElementChild?.dataset?.inline === "force"
) { ) {
const collapseNode = fragment.lastElementChild.firstChild; const collapseNode = fragment.lastElementChild.firstChild.firstChild;
if (this.isInlineStart) { if (this.isInlineStart) {
this.focusInline.before(...fragment.firstElementChild.children); this.focusInline.before(...fragment.firstElementChild.children);
} else if (this.isInlineEnd) { } else if (this.isInlineEnd) {
@ -1382,10 +1382,13 @@ export class SelectionController extends EventTarget {
*/ */
insertParagraph() { insertParagraph() {
if (this.isParagraphEnd) { if (this.isParagraphEnd) {
console.log('a')
return this.insertParagraphAfter(); return this.insertParagraphAfter();
} else if (this.isParagraphStart) { } else if (this.isParagraphStart) {
console.log('b')
return this.insertParagraphBefore(); return this.insertParagraphBefore();
} }
console.log('c')
return this.splitParagraph(); return this.splitParagraph();
} }