Vanessa 2024-01-15 00:20:15 +08:00
parent f40529c362
commit 9831a3d2c6
2 changed files with 9 additions and 32 deletions

View file

@ -582,6 +582,11 @@ export const focusBlock = (element: Element, parentElement?: HTMLElement, toStar
if (cursorElement.classList.contains("hljs")) {
// 代码块末尾定位需在 /n 之前 https://github.com/siyuan-note/siyuan/issues/9141https://github.com/siyuan-note/siyuan/issues/9189
let lastNode = cursorElement.lastChild;
if (!lastNode) {
// 粘贴 ``` 报错
cursorElement.innerHTML = "\n";
lastNode = cursorElement.lastChild;
}
if (lastNode.textContent === "" && lastNode.nodeType === 3) {
lastNode = hasPreviousSibling(cursorElement.lastChild) as HTMLElement;
}