This commit is contained in:
Vanessa 2022-06-20 22:31:54 +08:00
parent 370df7866c
commit ecff1bc3b7

View File

@ -412,8 +412,13 @@ export const focusBlock = (element: Element, parentElement?: HTMLElement, toStar
} else if (type === "NodeBlockQueryEmbed" && element.lastElementChild.previousElementSibling) { } else if (type === "NodeBlockQueryEmbed" && element.lastElementChild.previousElementSibling) {
range.selectNodeContents(element.lastElementChild.previousElementSibling); range.selectNodeContents(element.lastElementChild.previousElementSibling);
setRange = true; setRange = true;
} else if (["NodeMathBlock", "NodeHTMLBlock"].includes(type) && element.lastElementChild.previousElementSibling?.lastElementChild) { } else if (["NodeMathBlock", "NodeHTMLBlock"].includes(type)) {
// https://ld246.com/article/1655714737572
if (element.lastElementChild.previousElementSibling?.lastElementChild) {
range.selectNodeContents(element.lastElementChild.previousElementSibling.lastElementChild); range.selectNodeContents(element.lastElementChild.previousElementSibling.lastElementChild);
} else if (element.lastElementChild.previousElementSibling) {
range.selectNodeContents(element.lastElementChild.previousElementSibling);
}
setRange = true; setRange = true;
} else if (type === "NodeIFrame" || type === "NodeWidget") { } else if (type === "NodeIFrame" || type === "NodeWidget") {
range.setStart(element, 0); range.setStart(element, 0);