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/11581

Vanessa0a19cf33624e
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts
index ba646b6b4a..98b0e163ab 100644
--- a/app/src/protyle/wysiwyg/keydown.ts
+++ b/app/src/protyle/wysiwyg/keydown.ts
@@ -648,7 +648,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
) ||
(!firstEditElement && nodeElement.isSameNode(protyle.wysiwyg.element.firstElementChild))) {
// 不能用\n判断,否则文字过长折行将错误 https://github.com/siyuan-note/siyuan/issues/6156
- if (getSelectionPosition(nodeElement, range).top - protyle.wysiwyg.element.getBoundingClientRect().top < 40 || nodeElement.classList.contains("av")) {
+ if (getSelectionPosition(nodeElement, range).top - protyle.wysiwyg.element.getBoundingClientRect().top < 40 || position.start === 0 || nodeElement.classList.contains("av")) {
if (protyle.title && protyle.title.editElement &&
(protyle.wysiwyg.element.firstElementChild.getAttribute("data-eof") === "1" ||
protyle.contentElement.scrollTop === 0)) {
@@ -736,11 +736,13 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
// 需使用 innerText,否则 td 中的 br 无法转换为 \n; position.end 不能加1,否则倒数第二行行末无法下移
// 下一个块是折叠块
const nextFoldElement = getNextBlock(nodeElement) as HTMLElement;
- if (nextFoldElement && nextFoldElement.getAttribute("fold") === "1") {
+ if (nextFoldElement) {
focusBlock(nextFoldElement);
scrollCenter(protyle, nextFoldElement);
event.stopPropagation();
event.preventDefault();
+ } else {
+ range.collapse(false);
}
}
}