Vanessa 2025-06-12 22:39:36 +08:00
parent 7973499b63
commit d264ca0ac9

View file

@ -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;