From ed9e0da59eb6f595e7221fcf7f357e0f38c71218 Mon Sep 17 00:00:00 2001 From: WeiXi Zhang <54029053+Lagrange1813@users.noreply.github.com> Date: Fri, 21 Oct 2022 12:10:06 +0800 Subject: [PATCH] :bug: fix https://github.com/Vanessa219/vditor/issues/1289 (#1314) --- src/ts/util/fixBrowserBehavior.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ts/util/fixBrowserBehavior.ts b/src/ts/util/fixBrowserBehavior.ts index d1a931d22..95a9e5684 100644 --- a/src/ts/util/fixBrowserBehavior.ts +++ b/src/ts/util/fixBrowserBehavior.ts @@ -49,6 +49,10 @@ export const fixCJKPosition = (range: Range, vditor: IVditor, event: KeyboardEve const pLiElement = hasClosestByMatchTag(range.startContainer, "P") || hasClosestByMatchTag(range.startContainer, "LI"); 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, ''); + const zwspNode = document.createTextNode(Constants.ZWSP); range.insertNode(zwspNode); range.setStartAfter(zwspNode);