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

Vanessa29e91e3a9616
diff --git a/app/src/protyle/scroll/index.ts b/app/src/protyle/scroll/index.ts
index 41735a98ac..7a0bbf1cd4 100644
--- a/app/src/protyle/scroll/index.ts
+++ b/app/src/protyle/scroll/index.ts
@@ -5,7 +5,6 @@ import {fetchPost} from "../../util/fetch";
export class Scroll {
public element: HTMLElement;
private inputElement: HTMLInputElement;
- public blockSize: number;
public lastScrollTop: number;
public keepLazyLoad: boolean;
@@ -22,7 +21,7 @@ export class Scroll {
this.lastScrollTop = 0;
this.inputElement = divElement.firstElementChild as HTMLInputElement;
this.inputElement.addEventListener("input", () => {
- this.element.setAttribute("aria-label", `Blocks ${this.inputElement.value}/${this.blockSize}`);
+ this.element.setAttribute("aria-label", `Blocks ${this.inputElement.value}/${protyle.block.blockCount}`);
});
/// #if BROWSER
this.inputElement.addEventListener("change", () => {
@@ -52,16 +51,15 @@ export class Scroll {
});
}
- public update(blockSize: number, protyle: IProtyle) {
- if (typeof blockSize === "number") {
- this.blockSize = blockSize;
- this.inputElement.setAttribute("max", this.blockSize.toString());
- this.element.setAttribute("aria-label", `Blocks ${this.inputElement.value}/${this.blockSize}`);
+ public update(protyle: IProtyle) {
+ if (typeof protyle.block.blockCount === "number") {
+ this.inputElement.setAttribute("max", protyle.block.blockCount.toString());
+ this.element.setAttribute("aria-label", `Blocks ${this.inputElement.value}/${protyle.block.blockCount}`);
}
if (protyle.block.showAll) {
this.element.classList.add("fn__none");
} else {
- if (blockSize > Constants.SIZE_GET) {
+ if (protyle.block.childBlockCount > Constants.SIZE_GET) {
this.element.classList.remove("fn__none");
} else {
this.element.classList.add("fn__none");
diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.ts
index 7df5dc7cb0..f497ac018a 100644
--- a/app/src/protyle/util/onGet.ts
+++ b/app/src/protyle/util/onGet.ts
@@ -70,6 +70,7 @@ export const onGet = (data: IWebSocketData, protyle: IProtyle, action: string[]
protyle.block.showAll = false;
protyle.block.mode = data.data.mode;
protyle.block.blockCount = data.data.blockCount;
+ protyle.block.childBlockCount = data.data.childBlockCount;
protyle.block.action = action;
if (!action.includes(Constants.CB_GET_UNCHANGEID)) {
protyle.block.id = data.data.id;
@@ -177,7 +178,7 @@ const setHTML = (options: { content: string, action?: string[], unScroll?: boole
return;
}
if (protyle.options.render.scroll) {
- protyle.scroll.update(protyle.block.blockCount, protyle);
+ protyle.scroll.update(protyle);
}
if (options.action.includes(Constants.CB_GET_HL) && !options.unScroll) {
preventScroll(protyle); // 搜索页签滚动会导致再次请求
diff --git a/app/src/types/protyle.d.ts b/app/src/types/protyle.d.ts
index 799c607190..7f6c8b551b 100644
--- a/app/src/types/protyle.d.ts
+++ b/app/src/types/protyle.d.ts
@@ -389,6 +389,7 @@ interface IProtyle {
id: string,
block: {
id?: string,
+ childBlockCount?: number,
parentID?: string,
parent2ID?: string,
rootID?: string,