mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-21 15:56:10 +01:00
🎨 ECharts support asynchronous Immediately Invoked Function Expression (IIFE)) (#8015)
This commit is contained in:
parent
80c1b0350d
commit
b13398cbdd
1 changed files with 2 additions and 2 deletions
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue