import {isInEmbedBlock} from "../util/hasClosest"; import {Constants} from "../../constants"; export const genIconHTML = (element?: false | HTMLElement) => { let enable = true; if (element) { const readonly = element.getAttribute("data-readonly"); if (typeof readonly === "string") { enable = readonly === "false"; } else { return '
'; } } return `
`; }; export const genRenderFrame = (renderElement: Element) => { if (renderElement.querySelector(".protyle-cursor")) { return; } const type = renderElement.getAttribute("data-type"); if (type === "NodeBlockQueryEmbed") { renderElement.insertAdjacentHTML("afterbegin", `
${Constants.ZWSP}
`); } else if (type === "NodeMathBlock" || renderElement.getAttribute("data-subtype") === "math") { renderElement.firstElementChild.innerHTML = `${Constants.ZWSP}`; } }; export const processClonePHElement = (item: Element) => { item.querySelectorAll("protyle-html").forEach((phElement) => { phElement.setAttribute("data-content", Lute.UnEscapeHTMLStr(phElement.getAttribute("data-content"))); }); return item; };