Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/14443

Vanessa40dee1178237
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts
index 5ca4b16907..62781408f8 100644
--- a/app/src/protyle/wysiwyg/keydown.ts
+++ b/app/src/protyle/wysiwyg/keydown.ts
@@ -701,6 +701,15 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
scrollCenter(protyle, foldElement);
event.stopPropagation();
event.preventDefault();
+ } else {
+ // 修正光标上移至 \n 结尾的块时落点错误 https://github.com/siyuan-note/siyuan/issues/14443
+ const prevEditableElement = getContenteditableElement(previousElement) as HTMLElement;
+ if (prevEditableElement && prevEditableElement.innerText.endsWith("\n")) {
+ focusBlock(previousElement, undefined, false);
+ scrollCenter(protyle, previousElement);
+ event.stopPropagation();
+ event.preventDefault();
+ }
}
}
}