mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 16:58:49 +01:00
This commit is contained in:
parent
fcf7856431
commit
abc37e86d8
1 changed files with 11 additions and 6 deletions
|
|
@ -610,14 +610,19 @@ export class Toolbar {
|
|||
this.range.setEnd(nextElement.lastChild, nextIndex);
|
||||
} else if (newNodes.length > 0) {
|
||||
const lastNewNode = newNodes[newNodes.length - 1];
|
||||
if (lastNewNode.nodeType !== 3 && (lastNewNode as HTMLElement).getAttribute("data-type") === "inline-math") {
|
||||
const mathNextSibling = hasNextSibling(lastNewNode);
|
||||
if (mathNextSibling) { // https://github.com/siyuan-note/siyuan/issues/6065
|
||||
this.range.setStart(mathNextSibling, 0);
|
||||
if (lastNewNode.nodeType !== 3 && (lastNewNode as HTMLElement).getAttribute("data-type").indexOf("inline-math") > -1) {
|
||||
const mathPreviousSibling = hasPreviousSibling(lastNewNode);
|
||||
if (mathPreviousSibling && mathPreviousSibling.nodeType === 3) {
|
||||
this.range.setStart(mathPreviousSibling, mathPreviousSibling.textContent.length);
|
||||
} else {
|
||||
this.range.setStartAfter(lastNewNode);
|
||||
this.range.setStartBefore(lastNewNode);
|
||||
}
|
||||
const mathNextSibling = hasNextSibling(lastNewNode);
|
||||
if (mathNextSibling && mathNextSibling.nodeType === 3) { // https://github.com/siyuan-note/siyuan/issues/6065
|
||||
this.range.setEnd(mathNextSibling, 0);
|
||||
} else {
|
||||
this.range.setEndAfter(lastNewNode);
|
||||
}
|
||||
this.range.collapse(true);
|
||||
} else {
|
||||
if (lastNewNode.lastChild) {
|
||||
if (lastNewNode.lastChild.textContent === Constants.ZWSP) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue