Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

829 B
Raw Blame
export const htmlRender = (element: Element) => {
    let htmlElements: Element[] | NodeListOf<Element> = [];
    if (element.getAttribute("data-type") === "NodeHTMLBlock" && element.getAttribute("data-render") !== "true") {
        htmlElements = [element];
    } else {
        htmlElements = element.querySelectorAll('[data-type="NodeHTMLBlock"]:not([data-render="true"])');
    }
    if (htmlElements.length === 0) {
        return;
    }
    htmlElements.forEach((e) => {
        if (e.closest(".mindmap-view__preview-block")) {
            return;
        }
        e.setAttribute("data-render", "true");
        e.firstElementChild.firstElementChild.setAttribute("aria-label", window.siyuan.languages.edit);
        e.firstElementChild.lastElementChild.setAttribute("aria-label", window.siyuan.languages.more);
    });
};