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

Daniel402308bb36d3
diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.ts
index 33cd853eaf..449726951c 100644
--- a/app/src/protyle/util/onGet.ts
+++ b/app/src/protyle/util/onGet.ts
@@ -339,13 +339,16 @@ const setHTML = (options: {
}
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) => {
- // https://github.com/siyuan-note/siyuan/issues/8224
- // https://github.com/siyuan-note/siyuan/issues/10716
- if (index > 1 && protyle.block.blockCount > 1 && protyle.contentElement.scrollHeight <= protyle.contentElement.clientHeight) {
- showMessage(window.siyuan.languages.scrollGetMore);
- }
- });
+ const startId = options.scrollAttr.startId || protyle.wysiwyg.element.firstElementChild?.getAttribute("data-node-id");
+ if (startId) {
+ protyle.scroll.updateIndex(protyle, startId, (index) => {
+ // https://github.com/siyuan-note/siyuan/issues/8224
+ // https://github.com/siyuan-note/siyuan/issues/10716
+ if (index > 1 && protyle.block.blockCount > 1 && protyle.contentElement.scrollHeight <= protyle.contentElement.clientHeight) {
+ showMessage(window.siyuan.languages.scrollGetMore);
+ }
+ });
+ }
}
protyle.app.plugins.forEach(item => {