From 4de3649673def47acc1dca7ba4d215cd64073540 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 7 Oct 2024 19:45:34 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/12710 --- app/src/protyle/wysiwyg/keydown.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index 98f5db453..969c56c4e 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -736,14 +736,14 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { } else if (nodeEditableElement?.innerText.substr(position.end).indexOf("\n") === -1 || position.end >= nodeEditableElement.innerText.trimEnd().length) { // 需使用 innerText,否则 td 中的 br 无法转换为 \n; position.end 不能加1,否则倒数第二行行末无法下移 range.collapse(false); - const nextFoldElement = getNextBlock(nodeElement) as HTMLElement; - if (nextFoldElement) { - if(nodeEditableElement.getBoundingClientRect().bottom - getSelectionPosition(nodeElement, range).top < 40) { - focusBlock(nextFoldElement); - scrollCenter(protyle, nextFoldElement); - event.stopPropagation(); - event.preventDefault(); - } + const nextElement = getNextBlock(nodeElement) as HTMLElement; + if (nextElement && + (nextElement.getAttribute("fold") === "1" || nextElement.classList.contains("code-block")) && + nodeEditableElement.getBoundingClientRect().bottom - getSelectionPosition(nodeElement, range).top < 40) { + focusBlock(nextElement); + scrollCenter(protyle, nextElement); + event.stopPropagation(); + event.preventDefault(); } } }