From 0636b2e1fb808d444ad00b67a2a927f644a13e54 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 16 Jan 2025 22:58:13 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E9=87=8D=E5=90=AF=E5=90=8E=20listDocsB?= =?UTF-8?q?yPath=20=E8=AF=B7=E6=B1=82=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/layout/dock/Files.ts | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/app/src/layout/dock/Files.ts b/app/src/layout/dock/Files.ts index 530137580..02ce6a301 100644 --- a/app/src/layout/dock/Files.ts +++ b/app/src/layout/dock/Files.ts @@ -1019,16 +1019,6 @@ data-type="navigation-root" data-path="/"> let fileHTML = ""; data.files.forEach((item: IFile) => { fileHTML += this.genFileHTML(item); - if (filePath === item.path) { - this.selectItem(data.box, filePath, undefined, setStorage); - } else if (filePath.startsWith(item.path.replace(".sy", ""))) { - fetchPost("/api/filetree/listDocsByPath", { - notebook: data.box, - path: item.path - }, response => { - this.selectItem(response.data.box, filePath, response.data, setStorage); - }); - } }); if (fileHTML === "") { return; @@ -1046,6 +1036,18 @@ data-type="navigation-root" data-path="/"> emojiElement.textContent = unicode2Emoji(window.siyuan.storage[Constants.LOCAL_IMAGES].folder); } liElement.insertAdjacentHTML("afterend", ``); + data.files.forEach((item: IFile) => { + if (filePath === item.path) { + this.selectItem(data.box, filePath, undefined, setStorage); + } else if (filePath.startsWith(item.path.replace(".sy", ""))) { + fetchPost("/api/filetree/listDocsByPath", { + notebook: data.box, + path: item.path + }, response => { + this.selectItem(response.data.box, filePath, response.data, setStorage); + }); + } + }); if (setStorage) { this.setCurrent(this.element.querySelector(`ul[data-url="${data.box}"] li[data-path="${filePath}"]`)); }