mirror of
https://github.com/penpot/penpot.git
synced 2026-09-11 14:39:35 +00:00
Merge pull request #7554 from penpot/azazeln28-fix-text-editor-v2-issues
🐛 Fix text editor v2 render integration issues
This commit is contained in:
commit
89763d7c5a
@ -1047,6 +1047,17 @@ export class SelectionController extends EventTarget {
|
|||||||
return isParagraphEnd(this.focusNode, this.focusOffset);
|
return isParagraphEnd(this.focusNode, this.focusOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#getFragmentInlineTextNode(fragment) {
|
||||||
|
if (isInline(fragment.firstElementChild.lastChild)) {
|
||||||
|
return fragment.firstElementChild.firstElementChild.lastChild;
|
||||||
|
}
|
||||||
|
return fragment.firstElementChild.lastChild;
|
||||||
|
}
|
||||||
|
|
||||||
|
#getFragmentParagraphTextNode(fragment) {
|
||||||
|
return fragment.lastElementChild.lastElementChild.lastChild;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert pasted fragment.
|
* Insert pasted fragment.
|
||||||
*
|
*
|
||||||
@ -1071,7 +1082,7 @@ export class SelectionController extends EventTarget {
|
|||||||
}
|
}
|
||||||
return this.collapse(collapseNode, collapseNode.nodeValue.length);
|
return this.collapse(collapseNode, collapseNode.nodeValue.length);
|
||||||
}
|
}
|
||||||
const collapseNode = fragment.lastElementChild.lastElementChild.firstChild;
|
const collapseNode = this.#getFragmentParagraphTextNode(fragment);
|
||||||
if (this.isParagraphStart) {
|
if (this.isParagraphStart) {
|
||||||
const a = fragment.lastElementChild;
|
const a = fragment.lastElementChild;
|
||||||
const b = this.focusParagraph;
|
const b = this.focusParagraph;
|
||||||
@ -1090,6 +1101,9 @@ export class SelectionController extends EventTarget {
|
|||||||
);
|
);
|
||||||
this.focusParagraph.after(fragment, newParagraph);
|
this.focusParagraph.after(fragment, newParagraph);
|
||||||
}
|
}
|
||||||
|
if (isLineBreak(collapseNode)) {
|
||||||
|
return this.collapse(collapseNode, 0);
|
||||||
|
}
|
||||||
return this.collapse(collapseNode, collapseNode.nodeValue.length);
|
return this.collapse(collapseNode, collapseNode.nodeValue.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user