From 37b888f24de4101d92e3bae4c46cb969bc3dea12 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 25 Apr 2024 21:50:30 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/10671 --- app/src/util/newFile.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/util/newFile.ts b/app/src/util/newFile.ts index 8cc29a695..bc12bf090 100644 --- a/app/src/util/newFile.ts +++ b/app/src/util/newFile.ts @@ -111,10 +111,9 @@ export const newFile = (optios: { /// #endif }); } else { - // TODO fetchPost("/api/filetree/getHPathByPath", { notebook: data.data.box, - path: optios.currentPath.endsWith(".sy") ? optios.currentPath : optios.currentPath + ".sy" + path: optios.notebookId === data.data.box ? (optios.currentPath.endsWith(".sy") ? optios.currentPath : optios.currentPath + ".sy") : (data.data.path || "/") }, (responseHPath) => { fetchPost("/api/filetree/createDocWithMd", { notebook: data.data.box, @@ -140,7 +139,7 @@ export const newFile = (optios: { return; } const id = Lute.NewNodeID(); - const newPath = pathPosix().join(getDisplayName(optios.currentPath, false, true), id + ".sy"); + const newPath = optios.notebookId === data.data.box ? (pathPosix().join(getDisplayName(optios.currentPath, false, true), id + ".sy")) : (data.data.path || "/"); if (optios.paths) { optios.paths[optios.paths.indexOf(undefined)] = newPath; }