瀏覽代碼

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

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

+ 1 - 0
CHANGELOG.md

@@ -107,6 +107,7 @@
 
 ### v3.9.1 / 2023-03
 
+* [连续插入多个列表,控制台会报错](https://github.com/Vanessa219/vditor/issues/1343) `修复缺陷`
 * [IR 模式选择内容设置为代码块时异常](https://github.com/Vanessa219/vditor/issues/1354) `修复缺陷`
 
 ### v3.9.0 / 2023-01-15

+ 3 - 1
src/ts/util/fixBrowserBehavior.ts

@@ -51,7 +51,9 @@ export const fixCJKPosition = (range: Range, vditor: IVditor, event: KeyboardEve
     if (pLiElement && getSelectPosition(pLiElement, vditor[vditor.currentMode].element, range).start === 0) {
 
         // https://github.com/Vanessa219/vditor/issues/1289 WKWebView切换输入法产生六分之一空格,造成光标错位
-        pLiElement.nodeValue = pLiElement.nodeValue.replace(/\u2006/g, '');
+        if (pLiElement.nodeValue) {
+            pLiElement.nodeValue = pLiElement.nodeValue.replace(/\u2006/g, '');
+        }
 
         const zwspNode = document.createTextNode(Constants.ZWSP);
         range.insertNode(zwspNode);