瀏覽代碼

:art: fix https://github.com/siyuan-note/siyuan/issues/12468

Vanessa 10 月之前
父節點
當前提交
2f558b62cf
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      app/src/protyle/wysiwyg/keydown.ts

+ 3 - 1
app/src/protyle/wysiwyg/keydown.ts

@@ -882,7 +882,9 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
                     const inlineElement = hasClosestByMatchTag(range.startContainer, "SPAN");
                     const inlineElement = hasClosestByMatchTag(range.startContainer, "SPAN");
                     if (position.start === 2 && inlineElement &&
                     if (position.start === 2 && inlineElement &&
                         getSelectionOffset(inlineElement, protyle.wysiwyg.element, range).start === 1 &&
                         getSelectionOffset(inlineElement, protyle.wysiwyg.element, range).start === 1 &&
-                        inlineElement.innerText.startsWith(Constants.ZWSP)) {
+                        inlineElement.innerText.startsWith(Constants.ZWSP) &&
+                        // 需排除行内代码前有一个字符的情况
+                        editElement.innerText.startsWith(Constants.ZWSP)) {
                         focusBlock(nodeElement);
                         focusBlock(nodeElement);
                         event.stopPropagation();
                         event.stopPropagation();
                         event.preventDefault();
                         event.preventDefault();