diff --git a/app/src/layout/dock/Files.ts b/app/src/layout/dock/Files.ts index db4c43d4a..5cbd06589 100644 --- a/app/src/layout/dock/Files.ts +++ b/app/src/layout/dock/Files.ts @@ -914,6 +914,7 @@ data-type="navigation-root" data-path="/"> let html = ""; let closeHtml = ""; let closeCounter = 0; + const scrollTop = this.element.scrollTop; window.siyuan.notebooks.forEach((item) => { if (item.closed) { closeCounter++; @@ -931,10 +932,11 @@ data-type="navigation-root" data-path="/"> } else { this.closeElement.classList.add("fn__none"); } - window.siyuan.storage[Constants.LOCAL_FILESPATHS].forEach((item: IFilesPath) => { - item.openPaths.forEach((openPath) => { - this.selectItem(item.notebookId, openPath, undefined, false, false); - }); + window.siyuan.storage[Constants.LOCAL_FILESPATHS].forEach(async (item: IFilesPath) => { + for (const openPath of item.openPaths) { + await this.selectItem(item.notebookId, openPath, undefined, false, false); + } + this.element.scrollTop = scrollTop; }); this.refreshPublishAccessSwitch(); if (!init) {