From 21d1a0515ae46352a1bace0e17beac571d32c088 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 12 Oct 2023 11:54:15 +0800 Subject: [PATCH] =?UTF-8?q?:lipstick:=20=E7=BC=96=E8=BE=91=E5=90=8E?= =?UTF-8?q?=E8=A1=A8=E5=A4=B4=E4=B8=8D=E5=9B=BA=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/protyle/render/av/render.ts | 12 +++++++++++- app/src/protyle/scroll/event.ts | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.ts index f04d99ba38d..9d3be593c66 100644 --- a/app/src/protyle/render/av/render.ts +++ b/app/src/protyle/render/av/render.ts @@ -22,6 +22,8 @@ export const avRender = (element: Element, protyle: IProtyle, cb?: () => void) = return; } const left = e.querySelector(".av__scroll")?.scrollLeft || 0; + const headerTransform = (e.querySelector(".av__row--header") as HTMLElement)?.style.transform; + const footerTransform = (e.querySelector(".av__row--footer") as HTMLElement)?.style.transform; fetchPost("/api/av/renderAttributeView", { id: e.getAttribute("data-av-id"), }, (response) => { @@ -182,7 +184,15 @@ ${cell.color ? `color:${cell.color};` : ""}">${text}`; `; e.setAttribute("data-render", "true"); - e.querySelector(".av__scroll").scrollLeft = left; + if (left) { + e.querySelector(".av__scroll").scrollLeft = left; + } + if (headerTransform) { + (e.querySelector(".av__row--header") as HTMLElement).style.transform = headerTransform; + } + if (footerTransform) { + (e.querySelector(".av__row--footer") as HTMLElement).style.transform = footerTransform; + } if (cb) { cb(); } diff --git a/app/src/protyle/scroll/event.ts b/app/src/protyle/scroll/event.ts index 0013ce546fb..71bca5e9fe2 100644 --- a/app/src/protyle/scroll/event.ts +++ b/app/src/protyle/scroll/event.ts @@ -38,7 +38,7 @@ export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => { const footerElement = item.querySelector(".av__row--footer") as HTMLElement; if (footerElement) { const footerBottom = headerTop + footerElement.parentElement.clientHeight; - const scrollBottom = element.scrollTop + element.clientHeight; + const scrollBottom = element.scrollTop + element.clientHeight + 5; if (headerTop + 42 + 36 * 2 < scrollBottom && footerBottom > scrollBottom) { footerElement.style.transform = `translateY(${scrollBottom - footerBottom}px)`; } else {