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

Vanessa534b008dfe3a
diff --git a/app/src/asset/pdf/ui_utils.js b/app/src/asset/pdf/ui_utils.js
index 319d21cf80..98b74f2dbb 100644
--- a/app/src/asset/pdf/ui_utils.js
+++ b/app/src/asset/pdf/ui_utils.js
@@ -151,6 +151,8 @@ function watchScroll(viewAreaElement, callback, abortSignal = undefined) {
}
state.lastY = currentY;
callback(state);
+ // NOTE https://github.com/siyuan-note/siyuan/issues/12287 & https://github.com/siyuan-note/siyuan/issues/6890
+ viewAreaElement.dataset.scrolltop = viewAreaElement.scrollTop;
});
};
diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.ts
index 29004da977..3953521777 100644
--- a/app/src/layout/Wnd.ts
+++ b/app/src/layout/Wnd.ts
@@ -275,13 +275,6 @@ export class Wnd {
}
cloneTabElement.before(oldTab.headElement);
cloneTabElement.remove();
- if (oldTab.model instanceof Asset) {
- // https://github.com/siyuan-note/siyuan/issues/6890
- const pdfViewerElement = oldTab.model.element.querySelector("#viewerContainer");
- if (pdfViewerElement) {
- pdfViewerElement.setAttribute("data-scrolltop", pdfViewerElement.scrollTop.toString());
- }
- }
// 对象顺序
wnd.moveTab(oldTab, nextTabHeaderElement ? nextTabHeaderElement.getAttribute("data-id") : undefined);
resizeTabs();
@@ -364,13 +357,7 @@ export class Wnd {
if (!oldTab) {
return;
}
- if (oldTab.model instanceof Asset) {
- // https://github.com/siyuan-note/siyuan/issues/6890
- const pdfViewerElement = oldTab.model.element.querySelector("#viewerContainer");
- if (pdfViewerElement) {
- pdfViewerElement.setAttribute("data-scrolltop", pdfViewerElement.scrollTop.toString());
- }
- }
+
if (dragElement.style.height === "50%" || dragElement.style.width === "50%") {
// split
if (dragElement.style.height === "50%") {