Skip to content

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

840 B
Raw Blame
export const resetCodeBlockRenderState = (element: Element) => {
    const codeBlockElements: Element[] = [];
    if (element.getAttribute("data-type") === "NodeCodeBlock") {
        codeBlockElements.push(element);
    }
    codeBlockElements.push(...element.querySelectorAll('[data-type="NodeCodeBlock"]'));
    codeBlockElements.forEach(codeBlockElement => {
        codeBlockElement.querySelector(".hljs")?.removeAttribute("data-render");
        if (!codeBlockElement.classList.contains("render-node")) {
            return;
        }
        codeBlockElement.querySelector(".protyle-icons")?.remove();
        const spinElement = codeBlockElement.querySelector<HTMLElement>('[spin="1"]');
        if (spinElement) {
            spinElement.innerHTML = "";
        }
        codeBlockElement.removeAttribute("data-render");
    });
};