From 59cecc25c2323a1df7e1d11e8c28ea2cf751ee16 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sun, 15 Feb 2026 20:55:04 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/16633 --- app/src/protyle/gutter/index.ts | 17 ++++++++++++----- app/src/protyle/util/resize.ts | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts index 25d45b526..4d2922336 100644 --- a/app/src/protyle/gutter/index.ts +++ b/app/src/protyle/gutter/index.ts @@ -2302,7 +2302,10 @@ export class Gutter { data: e.outerHTML }); if (e.getAttribute("data-subtype") === "echarts") { - e.removeAttribute("data-render"); + const chartInstance = window.echarts.getInstanceById(e.querySelector('[_echarts_instance_]').getAttribute("_echarts_instance_")); + if (chartInstance) { + chartInstance.resize(); + } chartRender(e); } }); @@ -2343,8 +2346,10 @@ export class Gutter { e.style.width = item; e.style.flex = "none"; if (e.getAttribute("data-subtype") === "echarts") { - e.removeAttribute("data-render"); - chartRender(e); + const chartInstance = window.echarts.getInstanceById(e.querySelector('[_echarts_instance_]').getAttribute("_echarts_instance_")); + if (chartInstance) { + chartInstance.resize(); + } } }); } @@ -2387,8 +2392,10 @@ export class Gutter { e.style.width = ""; e.style.flex = ""; if (e.getAttribute("data-subtype") === "echarts") { - e.removeAttribute("data-render"); - chartRender(e); + const chartInstance = window.echarts.getInstanceById(e.querySelector('[_echarts_instance_]').getAttribute("_echarts_instance_")); + if (chartInstance) { + chartInstance.resize(); + } } } }); diff --git a/app/src/protyle/util/resize.ts b/app/src/protyle/util/resize.ts index b8cdd5c46..e2b1c0bb9 100644 --- a/app/src/protyle/util/resize.ts +++ b/app/src/protyle/util/resize.ts @@ -67,7 +67,7 @@ export const resize = (protyle: IProtyle) => { if (abs.width > MIN_ABS || isNaN(abs.width)) { if (typeof window.echarts !== "undefined") { protyle.wysiwyg.element.querySelectorAll('[data-subtype="echarts"], [data-subtype="mindmap"]').forEach((chartItem: HTMLElement) => { - const chartInstance = window.echarts.getInstanceById(chartItem.firstElementChild.nextElementSibling.getAttribute("_echarts_instance_")); + const chartInstance = window.echarts.getInstanceById(chartItem.querySelector('[_echarts_instance_]').getAttribute("_echarts_instance_")); if (chartInstance) { chartInstance.resize(); }