mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-31 22:08:48 +01:00
This commit is contained in:
parent
6c6a266df7
commit
c2f10b73d6
1 changed files with 9 additions and 8 deletions
|
|
@ -85,12 +85,13 @@ export const getContenteditableElement = (element: Element): Element => {
|
|||
let blockElement = element;
|
||||
if (!blockElement.getAttribute("data-node-id")) {
|
||||
blockElement = element.querySelector("[data-node-id]");
|
||||
if (!blockElement) {
|
||||
blockElement = hasClosestBlock(blockElement) as Element;
|
||||
}
|
||||
}
|
||||
if (!blockElement) {
|
||||
return element;
|
||||
const tempBlockElement = hasClosestBlock(element);
|
||||
if (tempBlockElement && element === getContenteditableElement(tempBlockElement)) {
|
||||
return element;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
const type = blockElement.getAttribute("data-type");
|
||||
if (["NodeParagraph", "NodeHeading"].includes(type)) {
|
||||
|
|
@ -100,11 +101,11 @@ export const getContenteditableElement = (element: Element): Element => {
|
|||
} else if ("NodeCodeBlock" === type && blockElement.classList.contains("code-block")) {
|
||||
return blockElement.querySelector(".hljs").lastElementChild;
|
||||
} else if (["NodeBlockQueryEmbed", "NodeMathBlock", "NodeHTMLBlock"].includes(type)) {
|
||||
return element;
|
||||
} else if (element.getAttribute("data-node-id")) {
|
||||
return getContenteditableElement(element.querySelector("[data-node-id]"));
|
||||
return undefined;
|
||||
} else if (blockElement.getAttribute("data-node-id")) {
|
||||
return getContenteditableElement(blockElement.querySelector("[data-node-id]"));
|
||||
}
|
||||
return element;
|
||||
return undefined;
|
||||
};
|
||||
|
||||
export const isNotEditBlock = (element: Element) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue