Skip to content

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

:bug: fix https://github.com/siyuan-note/siyuan/issues/5255

Vanessaf7f875e1b3f2
diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.ts
index d7ccba5968..4607054c72 100644
--- a/app/src/layout/Wnd.ts
+++ b/app/src/layout/Wnd.ts
@@ -23,6 +23,8 @@ import {showMessage} from "../dialog/message";
import {openFileById, updatePanelByEditor} from "../editor/util";
import {scrollCenter} from "../util/highlightById";
import {getAllModels} from "./getAll";
+import {fetchPost} from "../util/fetch";
+import {onGet} from "../protyle/util/onGet";
export class Wnd {
public id: string;
@@ -337,6 +339,22 @@ export class Wnd {
if (update) {
updatePanelByEditor(currentTab.model.editor.protyle, true, pushBack);
}
+
+ // 切换到屏幕太高的页签 https://github.com/siyuan-note/siyuan/issues/5018
+ const protyle = currentTab.model.editor.protyle;
+ if (!protyle.scroll.element.classList.contains("fn__none") &&
+ protyle.wysiwyg.element.lastElementChild.getAttribute("data-eof") !== "true" &&
+ protyle.contentElement.scrollHeight > 0 &&
+ protyle.contentElement.scrollHeight <= protyle.contentElement.clientHeight) {
+ fetchPost("/api/filetree/getDoc", {
+ id: protyle.wysiwyg.element.lastElementChild.getAttribute("data-node-id"),
+ mode: 2,
+ k: protyle.options.key || "",
+ size: Constants.SIZE_GET,
+ }, getResponse => {
+ onGet(getResponse, protyle, [Constants.CB_GET_APPEND, Constants.CB_GET_UNCHANGEID]);
+ });
+ }
} else {
updatePanelByEditor(undefined, false);
}
diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.ts
index 680771803a..d565064248 100644
--- a/app/src/protyle/util/onGet.ts
+++ b/app/src/protyle/util/onGet.ts
@@ -178,9 +178,10 @@ const setHTML = (options: { content: string, action?: string[] }, protyle: IProt
if (protyle.element.classList.contains("block__edit") && (protyle.element.nextElementSibling || protyle.element.previousElementSibling)) {
protyle.element.style.minHeight = Math.min(30 + protyle.wysiwyg.element.clientHeight, window.innerHeight / 3) + "px";
}
- // https://github.com/siyuan-note/siyuan/issues/5018
+ // 屏幕太高的页签 https://github.com/siyuan-note/siyuan/issues/5018
if (!protyle.scroll.element.classList.contains("fn__none") &&
protyle.wysiwyg.element.lastElementChild.getAttribute("data-eof") !== "true" &&
+ protyle.contentElement.scrollHeight > 0 && // 没有激活的页签 https://github.com/siyuan-note/siyuan/issues/5255
protyle.contentElement.scrollHeight <= protyle.contentElement.clientHeight) {
fetchPost("/api/filetree/getDoc", {
id: protyle.wysiwyg.element.lastElementChild.getAttribute("data-node-id"),