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

Vanessadea4d0ea6f64
diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.ts
index 36e439396c..b62c4f4731 100644
--- a/app/src/protyle/util/onGet.ts
+++ b/app/src/protyle/util/onGet.ts
@@ -316,6 +316,21 @@ const setHTML = (options: {
onGet({data: getResponse, protyle, action: [Constants.CB_GET_APPEND, Constants.CB_GET_UNCHANGEID]});
});
}
+ // 动态滚动条拖拽到最后几个块时需多加载一点块 https://github.com/siyuan-note/siyuan/issues/16906
+ if (options.action.includes(Constants.CB_GET_FOCUSFIRST) &&
+ protyle.contentElement.scrollHeight <= protyle.contentElement.clientHeight) {
+ fetchPost("/api/filetree/getDoc", {
+ id: protyle.wysiwyg.element.firstElementChild.getAttribute("data-node-id"),
+ mode: 1,
+ size: window.siyuan.config.editor.dynamicLoadBlocks,
+ }, getResponse => {
+ onGet({
+ data: getResponse,
+ protyle,
+ action: [Constants.CB_GET_BEFORE, Constants.CB_GET_UNCHANGEID],
+ });
+ });
+ }
if (options.scrollAttr && !protyle.scroll.element.classList.contains("fn__none") && !protyle.element.classList.contains("fn__none")) {
// 使用动态滚动条定位到最后一个块,重启后无法触发滚动事件,需要再次更新 index
protyle.scroll.updateIndex(protyle, options.scrollAttr.startId, (index) => {