🐛 Fix wrong blinking position after paste (#5756)

This commit is contained in:
Aitor Moreno 2025-02-04 11:29:25 +01:00 committed by GitHub
parent f8ba029b62
commit 774cf81fc8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1047,6 +1047,7 @@ export class SelectionController extends EventTarget {
if (fragment.children.length === 1 if (fragment.children.length === 1
&& fragment.firstElementChild?.dataset?.inline === "force" && fragment.firstElementChild?.dataset?.inline === "force"
) { ) {
const collapseNode = fragment.lastElementChild.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) {
@ -1058,9 +1059,12 @@ export class SelectionController extends EventTarget {
) )
this.focusInline.after(...fragment.firstElementChild.children, newInline) this.focusInline.after(...fragment.firstElementChild.children, newInline)
} }
return; return this.collapse(
collapseNode,
collapseNode.nodeValue.length
);
} }
const collapseNode = fragment.lastElementChild.lastElementChild.firstChild
if (this.isParagraphStart) { if (this.isParagraphStart) {
this.focusParagraph.before(fragment); this.focusParagraph.before(fragment);
} else if (this.isParagraphEnd) { } else if (this.isParagraphEnd) {
@ -1073,6 +1077,7 @@ export class SelectionController extends EventTarget {
); );
this.focusParagraph.after(fragment, newParagraph); this.focusParagraph.after(fragment, newParagraph);
} }
return this.collapse(collapseNode, collapseNode.nodeValue.length);
} }
/** /**