mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 08:30:12 +01:00
🚨
This commit is contained in:
parent
81c1d785a7
commit
21f1f48a50
4 changed files with 12 additions and 12 deletions
|
|
@ -40,31 +40,31 @@ export const selectAll = (protyle: IProtyle, nodeElement: Element, range: Range)
|
|||
range.setStart(firstChild, 0);
|
||||
break;
|
||||
}
|
||||
firstChild = firstChild.nextSibling
|
||||
firstChild = firstChild.nextSibling;
|
||||
} else {
|
||||
if ((firstChild as HTMLElement).classList.contains("render-node") ||
|
||||
(firstChild as HTMLElement).classList.contains("img")) {
|
||||
range.setStartBefore(firstChild);
|
||||
break;
|
||||
}
|
||||
firstChild = firstChild.firstChild
|
||||
firstChild = firstChild.firstChild;
|
||||
}
|
||||
}
|
||||
let lastChild = editElement.lastChild
|
||||
let lastChild = editElement.lastChild;
|
||||
while (lastChild) {
|
||||
if (lastChild.nodeType === 3) {
|
||||
if (lastChild.textContent !== "") {
|
||||
range.setEnd(lastChild, lastChild.textContent.length);
|
||||
break;
|
||||
}
|
||||
lastChild = lastChild.previousSibling
|
||||
lastChild = lastChild.previousSibling;
|
||||
} else {
|
||||
if ((lastChild as HTMLElement).classList.contains("render-node") ||
|
||||
(lastChild as HTMLElement).classList.contains("img")) {
|
||||
range.setEndAfter(lastChild);
|
||||
break;
|
||||
}
|
||||
lastChild = lastChild.lastChild
|
||||
lastChild = lastChild.lastChild;
|
||||
}
|
||||
}
|
||||
protyle.toolbar.render(protyle, range);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue