From f5a36b945970f2b5325ba76081dd3549479e4566 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Fri, 8 Aug 2025 12:15:26 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/15226 --- app/src/protyle/wysiwyg/keydown.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index 3ef5d356e..5fee2d41d 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -855,13 +855,15 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { const cloneRange = range.cloneRange(); const nextElement = getNextBlock(getTopAloneElement(nodeElement)); if (nextElement) { - const nextRange = focusBlock(nextElement); - if (nextRange) { - const nextBlockElement = hasClosestBlock(nextRange.startContainer); - if (nextBlockElement) { - // 反向删除合并为一个块时,光标应保持在尾部 https://github.com/siyuan-note/siyuan/issues/14290#issuecomment-2849810529 - cloneRange.insertNode(document.createElement("wbr")); - removeBlock(protyle, nextBlockElement, nextRange, "Delete"); + if (!nodeElement.classList.contains("code-block")) { + const nextRange = focusBlock(nextElement); + if (nextRange) { + const nextBlockElement = hasClosestBlock(nextRange.startContainer); + if (nextBlockElement) { + // 反向删除合并为一个块时,光标应保持在尾部 https://github.com/siyuan-note/siyuan/issues/14290#issuecomment-2849810529 + cloneRange.insertNode(document.createElement("wbr")); + removeBlock(protyle, nextBlockElement, nextRange, "Delete"); + } } } event.stopPropagation();