Browse Source

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

Vanessa 1 year ago
parent
commit
cc8223593c
2 changed files with 6 additions and 0 deletions
  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
 ### v3.10.7 / 2024-10
 
 
+* [撤销后 echart 无法渲染](https://github.com/Vanessa219/vditor/issues/1673) `修复缺陷`
+
 ### v3.10.6 / 2024-09-11
 ### v3.10.6 / 2024-09-11
 
 
 * [支持 echarts 中执行函数](https://github.com/Vanessa219/vditor/issues/1672) `改进功能`
 * [支持 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;
         this[vditor.currentMode].lastText = text;
         vditor[vditor.currentMode].element.innerHTML = text;
         vditor[vditor.currentMode].element.innerHTML = text;
         if (vditor.currentMode !== "sv") {
         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']`)
             vditor[vditor.currentMode].element.querySelectorAll(`.vditor-${vditor.currentMode}__preview[data-render='2']`)
                 .forEach((blockElement: HTMLElement) => {
                 .forEach((blockElement: HTMLElement) => {
                     processCodeRender(blockElement, vditor);
                     processCodeRender(blockElement, vditor);