瀏覽代碼

:bug: fix https://github.com/Vanessa219/vditor/issues/1673

Vanessa 1 年之前
父節點
當前提交
cc8223593c
共有 2 個文件被更改,包括 6 次插入0 次删除
  1. 2 0
      CHANGELOG.md
  2. 4 0
      src/ts/undo/index.ts

+ 2 - 0
CHANGELOG.md

@@ -19,6 +19,8 @@
 
 ### v3.10.7 / 2024-10
 
+* [撤销后 echart 无法渲染](https://github.com/Vanessa219/vditor/issues/1673) `修复缺陷`
+
 ### v3.10.6 / 2024-09-11
 
 * [支持 echarts 中执行函数](https://github.com/Vanessa219/vditor/issues/1672) `改进功能`

+ 4 - 0
src/ts/undo/index.ts

@@ -149,6 +149,10 @@ class Undo {
         this[vditor.currentMode].lastText = text;
         vditor[vditor.currentMode].element.innerHTML = text;
         if (vditor.currentMode !== "sv") {
+            vditor[vditor.currentMode].element.querySelectorAll(`.vditor-${vditor.currentMode}__preview`)
+                .forEach((blockElement: HTMLElement) => {
+                    blockElement.outerHTML = vditor.lute.SpinVditorDOM(blockElement.parentElement.outerHTML);
+                });
             vditor[vditor.currentMode].element.querySelectorAll(`.vditor-${vditor.currentMode}__preview[data-render='2']`)
                 .forEach((blockElement: HTMLElement) => {
                     processCodeRender(blockElement, vditor);