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

Vanessa708d32b6685e
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts
index 62781408f8..bda3e0acf7 100644
--- a/app/src/protyle/wysiwyg/keydown.ts
+++ b/app/src/protyle/wysiwyg/keydown.ts
@@ -704,11 +704,9 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
} 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();
+ if (prevEditableElement && prevEditableElement.lastChild.nodeType === 3 &&
+ prevEditableElement.lastChild.textContent.endsWith("\n")) {
+ prevEditableElement.lastChild.textContent = prevEditableElement.lastChild.textContent.replace(/\n$/, "");
}
}
}