Skip to content

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

:art: ECharts support asynchronous Immediately Invoked Function Expression (IIFE)) (#8015)

颖逸b13398cbddc3
diff --git a/app/src/protyle/markdown/chartRender.ts b/app/src/protyle/markdown/chartRender.ts
index 79d58c691f..c556469d0e 100644
--- a/app/src/protyle/markdown/chartRender.ts
+++ b/app/src/protyle/markdown/chartRender.ts
@@ -29,7 +29,7 @@ export const chartRender = (element: Element, cdn = Constants.PROTYLE_CDN) => {
});
}
}
- echartsElements.forEach((e: HTMLDivElement) => {
+ echartsElements.forEach(async (e: HTMLDivElement) => {
if (e.getAttribute("data-render") === "true") {
return;
}
@@ -39,7 +39,7 @@ export const chartRender = (element: Element, cdn = Constants.PROTYLE_CDN) => {
const renderElement = e.firstElementChild.nextElementSibling as HTMLElement;
try {
renderElement.style.height = e.style.height;
- const option = looseJsonParse(Lute.UnEscapeHTMLStr(e.getAttribute("data-content")));
+ const option = await looseJsonParse(Lute.UnEscapeHTMLStr(e.getAttribute("data-content")));
echarts.init(renderElement, window.siyuan.config.appearance.mode === 1 ? "dark" : undefined, {width}).setOption(option);
e.setAttribute("data-render", "true");
renderElement.classList.remove("ft__error");