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

Vanessad264ca0ac983
diff --git a/app/src/protyle/render/av/gallery/render.ts b/app/src/protyle/render/av/gallery/render.ts
index a870289ba3..e57a7ef838 100644
--- a/app/src/protyle/render/av/gallery/render.ts
+++ b/app/src/protyle/render/av/gallery/render.ts
@@ -13,11 +13,12 @@ import {getViewIcon} from "../view";
export const renderGallery = (options: {
blockElement: HTMLElement,
protyle: IProtyle,
- cb?: (data:IAV) => void,
+ cb?: (data: IAV) => void,
viewID?: string,
renderAll: boolean
}) => {
const alignSelf = options.blockElement.style.alignSelf;
+ let oldOffset: number;
if (options.blockElement.firstElementChild.innerHTML === "") {
options.blockElement.style.alignSelf = "";
options.blockElement.firstElementChild.outerHTML = `<div class="av__gallery">
@@ -25,6 +26,8 @@ export const renderGallery = (options: {
<span style="width: 100%;height: 178px;" class="av__pulse"></span>
<span style="width: 100%;height: 178px;" class="av__pulse"></span>
</div>`;
+ } else {
+ oldOffset = options.protyle.contentElement.scrollTop;
}
const selectItemIds: string[] = [];
@@ -183,6 +186,9 @@ ${view.hideAttrViewName ? " av__gallery--top" : ""}">
galleryElement.classList.remove("av__gallery--top");
}
}
+ if (typeof oldOffset === "number") {
+ options.protyle.contentElement.scrollTop = oldOffset;
+ }
options.blockElement.setAttribute("data-render", "true");
if (alignSelf) {
options.blockElement.style.alignSelf = alignSelf;