This commit is contained in:
Vanessa 2024-12-13 19:52:05 +08:00
parent aa36b95bdb
commit 45bd7be977
2 changed files with 7 additions and 1 deletions

View file

@ -18,6 +18,9 @@ const forwardStack: IBackStack[] = [];
const focusStack = (backStack: IBackStack) => {
const protyle = getCurrentEditor().protyle;
// 前进后快速后退会导致滚动错位 https://ld246.com/article/1734018624070
protyle.observerLoad.disconnect();
window.siyuan.storage[Constants.LOCAL_DOCINFO] = {
id: backStack.id,
};
@ -95,6 +98,10 @@ const focusStack = (backStack: IBackStack) => {
setReadonlyByConfig(protyle, true);
}
protyle.contentElement.scrollTop = backStack.scrollTop;
// 等待 av 等加载 https://ld246.com/article/1734018624070
setTimeout(() => {
protyle.contentElement.scrollTop = backStack.scrollTop;
}, Constants.TIMEOUT_LOAD);
});
};

View file

@ -307,7 +307,6 @@ export const cellScrollIntoView = (blockElement: HTMLElement, cellElement: Eleme
if (contentElement && cellElement.getAttribute("data-dtype") !== "checkbox") {
const keyboardToolbarElement = document.getElementById("keyboardToolbar");
const keyboardH = parseInt(keyboardToolbarElement.getAttribute("data-keyboardheight")) || (window.outerHeight / 2 - 42);
console.log(keyboardH, window.innerHeight, cellRect.bottom);
if (cellRect.bottom > window.innerHeight - keyboardH - 42) {
contentElement.scrollTop += cellRect.bottom - window.innerHeight + 42 + keyboardH;
} else if (cellRect.top < 110) {