Kaynağa Gözat

:art: https://github.com/siyuan-note/siyuan/issues/12287

Vanessa 9 ay önce
ebeveyn
işleme
534b008dfe
2 değiştirilmiş dosya ile 3 ekleme ve 14 silme
  1. 2 0
      app/src/asset/pdf/ui_utils.js
  2. 1 14
      app/src/layout/Wnd.ts

+ 2 - 0
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;
     });
   };
 

+ 1 - 14
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%") {