mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-20 15:26:09 +01:00
15 lines
645 B
TypeScript
15 lines
645 B
TypeScript
export const removeFoldHeading = (nodeElement: Element) => {
|
|
const nodeH = parseInt(nodeElement.getAttribute("data-subtype").substr(1));
|
|
let nextElement = nodeElement.nextElementSibling;
|
|
while (nextElement) {
|
|
const currentH = parseInt(nextElement.getAttribute("data-subtype")?.substr(1));
|
|
if (!nextElement.classList.contains("protyle-attr") && // 超级块末尾为属性
|
|
(isNaN(currentH) || currentH > nodeH)) {
|
|
const tempElement = nextElement;
|
|
nextElement = nextElement.nextElementSibling;
|
|
tempElement.remove();
|
|
} else {
|
|
break;
|
|
}
|
|
}
|
|
};
|