mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-21 06:24:06 +01:00
This commit is contained in:
parent
41b14025b4
commit
f69cad6349
2 changed files with 6 additions and 2 deletions
|
|
@ -38,6 +38,8 @@ export const chartRender = (element: Element, cdn = Constants.PROTYLE_CDN) => {
|
|||
try {
|
||||
if (!renderElement.lastElementChild || renderElement.childElementCount === 1) {
|
||||
renderElement.innerHTML = `<span style="position: absolute;left:0;top:0;width: 1px;">${Constants.ZWSP}</span><div style="height:${e.style.height || "420px"}" contenteditable="false"></div>`;
|
||||
} else {
|
||||
renderElement.lastElementChild.classList.remove("ft__error");
|
||||
}
|
||||
const chartInstance = window.echarts.getInstanceById(renderElement.lastElementChild?.getAttribute("_echarts_instance_"));
|
||||
const option = await looseJsonParse(Lute.UnEscapeHTMLStr(e.getAttribute("data-content")));
|
||||
|
|
@ -50,7 +52,7 @@ export const chartRender = (element: Element, cdn = Constants.PROTYLE_CDN) => {
|
|||
window.echarts.init(renderElement.lastElementChild, window.siyuan.config.appearance.mode === 1 ? "dark" : undefined, {width}).setOption(option);
|
||||
} catch (error) {
|
||||
window.echarts.dispose(renderElement.lastElementChild);
|
||||
renderElement.innerHTML = `<span style="position: absolute;left:0;top:0;width: 1px;">${Constants.ZWSP}</span><div class="ft__error" contenteditable="false">echarts render error: <br>${error}</div>`;
|
||||
renderElement.innerHTML = `<span style="position: absolute;left:0;top:0;width: 1px;">${Constants.ZWSP}</span><div class="ft__error" style="height:${e.style.height || "420px"}" contenteditable="false">echarts render error: <br>${error}</div>`;
|
||||
}
|
||||
e.setAttribute("data-render", "true");
|
||||
});
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ export const mindmapRender = (element: Element, cdn = Constants.PROTYLE_CDN) =>
|
|||
try {
|
||||
if (!renderElement.lastElementChild || renderElement.childElementCount === 1) {
|
||||
renderElement.innerHTML = `<span style="position: absolute;left:0;top:0;width: 1px;">${Constants.ZWSP}</span><div style="height:${e.style.height || "420px"}" contenteditable="false"></div>`;
|
||||
} else {
|
||||
renderElement.lastElementChild.classList.remove("ft__error");
|
||||
}
|
||||
window.echarts.init(renderElement.lastElementChild, window.siyuan.config.appearance.mode === 1 ? "dark" : undefined, {
|
||||
width,
|
||||
|
|
@ -81,7 +83,7 @@ export const mindmapRender = (element: Element, cdn = Constants.PROTYLE_CDN) =>
|
|||
});
|
||||
} catch (error) {
|
||||
window.echarts.dispose(renderElement.lastElementChild);
|
||||
renderElement.innerHTML = `<span style="position: absolute;left:0;top:0;width: 1px;">${Constants.ZWSP}</span><div class="ft__error" contenteditable="false">Mindmap render error: <br>${error}</div>`;
|
||||
renderElement.innerHTML = `<span style="position: absolute;left:0;top:0;width: 1px;">${Constants.ZWSP}</span><div class="ft__error" style="height:${e.style.height || "420px"}" contenteditable="false">Mindmap render error: <br>${error}</div>`;
|
||||
}
|
||||
e.setAttribute("data-render", "true");
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue