This commit is contained in:
Vanessa 2024-05-13 17:06:28 +08:00
parent f15b2f8666
commit b2b1089e3d
7 changed files with 27 additions and 22 deletions

View file

@ -98,7 +98,7 @@ export const newFile = (optios: {
}
if ((data.data.path.indexOf("/") > -1 && optios.useSavePath) || optios.name) {
if (data.data.path.startsWith("/") || optios.currentPath === "/") {
const createPath = pathPosix().join(data.data.path, optios.name || (data.data.path.endsWith("/") ? window.siyuan.languages.untitled : ""))
const createPath = pathPosix().join(data.data.path, optios.name || (data.data.path.endsWith("/") ? window.siyuan.languages.untitled : ""));
fetchPost("/api/filetree/createDocWithMd", {
notebook: data.data.box,
path: createPath,
@ -123,7 +123,7 @@ export const newFile = (optios: {
notebook: data.data.box,
path: optios.notebookId === data.data.box ? (optios.currentPath.endsWith(".sy") ? optios.currentPath : optios.currentPath + ".sy") : (data.data.path || "/")
}, (responseHPath) => {
const createPath = pathPosix().join(responseHPath.data, data.data.path, optios.name || (data.data.path.endsWith("/") ? window.siyuan.languages.untitled : ""))
const createPath = pathPosix().join(responseHPath.data, data.data.path, optios.name || (data.data.path.endsWith("/") ? window.siyuan.languages.untitled : ""));
fetchPost("/api/filetree/createDocWithMd", {
notebook: data.data.box,
path: createPath,
@ -151,7 +151,7 @@ export const newFile = (optios: {
return;
}
if (optios.notebookId !== data.data.box) {
const createPath = pathPosix().join(data.data.path || "/", optios.name || (data.data.path.endsWith("/") ? window.siyuan.languages.untitled : ""))
const createPath = pathPosix().join(data.data.path || "/", optios.name || (data.data.path.endsWith("/") ? window.siyuan.languages.untitled : ""));
fetchPost("/api/filetree/createDocWithMd", {
notebook: data.data.box,
path: createPath,