This commit is contained in:
Vanessa 2022-12-21 14:35:05 +08:00
parent 9cf02cb629
commit cc27cb6ef9
2 changed files with 13 additions and 0 deletions

View file

@ -32,6 +32,12 @@ export const pdfResize = () => {
if (!pdfDocument) {
return;
}
const pdfViewerElement = item.element.querySelector("#viewerContainer")
if (pdfViewerElement) {
// https://github.com/siyuan-note/siyuan/issues/6890
pdfViewerElement.scrollTo(0, parseInt(pdfViewerElement.getAttribute("data-scrolltop")));
pdfViewerElement.removeAttribute("data-scrolltop")
}
const currentScaleValue = pdfViewer.currentScaleValue;
if (
currentScaleValue === "auto" ||

View file

@ -280,6 +280,13 @@ export class Wnd {
const targetWnd = getInstanceById(targetWndElement.getAttribute("data-id")) as Wnd;
const tabId = event.dataTransfer.getData(Constants.SIYUAN_DROP_TAB);
const oldTab = getInstanceById(tabId) as Tab;
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%") {