Vanessa hace 5 años
padre
commit
3acae8ca26
Se han modificado 2 ficheros con 14 adiciones y 0 borrados
  1. 2 0
      CHANGELOG.md
  2. 12 0
      src/ts/sv/inputEvent.ts

+ 2 - 0
CHANGELOG.md

@@ -88,6 +88,8 @@
 
 ### v3.7.5 / 2020-12-xx
 
+* [877](https://github.com/Vanessa219/vditor/issues/877) 数学公式输入删除生成节点 `修复缺陷`
+* [882](https://github.com/Vanessa219/vditor/issues/882) 改进 HTML 转换 Markdown 时加粗、斜体等空格的处理 `改进功能`
 * [878](https://github.com/Vanessa219/vditor/issues/878) 移除列表标记符中文优化 `改进功能`
 * [875](https://github.com/Vanessa219/vditor/issues/875) 增加大纲位置配置 `引入特性`
 * [873](https://github.com/Vanessa219/vditor/issues/873) graphviz,mermaid 在为空时不应出现错误提示 `改进功能`

+ 12 - 0
src/ts/sv/inputEvent.ts

@@ -56,6 +56,18 @@ export const inputEvent = (vditor: IVditor, event?: InputEvent) => {
                     }
                 }
             }
+            // https://github.com/Vanessa219/vditor/issues/877 数学公式输入删除生成节点
+            const mathBlockMarkerElement =
+                hasClosestByAttribute(startContainer, "data-type", "math-block-open-marker");
+            if (mathBlockMarkerElement) {
+                const mathBlockCloseElement = mathBlockMarkerElement.nextElementSibling.nextElementSibling
+                if (mathBlockCloseElement && mathBlockCloseElement.getAttribute("data-type") === "math-block-close-marker") {
+                    mathBlockCloseElement.remove();
+                    processAfterRender(vditor);
+                }
+                return;
+            }
+
             blockElement.querySelectorAll('[data-type="code-block-open-marker"]').forEach((item: HTMLElement) => {
                 if (item.textContent.length === 1) {
                     item.remove();