This commit is contained in:
Vanessa 2022-10-05 23:26:37 +08:00 committed by Liang Ding
parent 71389114bb
commit 35307911d1
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -570,8 +570,9 @@ export class Toolbar {
} else if (newNodes.length > 0) {
const lastNewNode = newNodes[newNodes.length - 1];
if (lastNewNode.nodeType !== 3 && (lastNewNode as HTMLElement).getAttribute("data-type") === "inline-math") {
if (lastNewNode.nextSibling) {
this.range.setStart(lastNewNode.nextSibling, 0);
const mathNextSibling = hasNextSibling(lastNewNode);
if (mathNextSibling) { // https://github.com/siyuan-note/siyuan/issues/6065
this.range.setStart(mathNextSibling, 0);
} else {
this.range.setStartAfter(lastNewNode);
}