mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 00:50:13 +01:00
This commit is contained in:
parent
e4cee23592
commit
9286f21c95
1 changed files with 3 additions and 4 deletions
|
|
@ -94,7 +94,7 @@ export const newFile = (optios: {
|
||||||
if (data.data.path.startsWith("/") || optios.currentPath === "/") {
|
if (data.data.path.startsWith("/") || optios.currentPath === "/") {
|
||||||
fetchPost("/api/filetree/createDocWithMd", {
|
fetchPost("/api/filetree/createDocWithMd", {
|
||||||
notebook: optios.notebookId,
|
notebook: optios.notebookId,
|
||||||
path: pathPosix().join(data.data.path, optios.name || ""),
|
path: pathPosix().join(data.data.path, optios.name || (data.data.path.endsWith("/") ? "Untitled" : "")),
|
||||||
// 根目录时无法确定 parentID
|
// 根目录时无法确定 parentID
|
||||||
markdown: ""
|
markdown: ""
|
||||||
}, response => {
|
}, response => {
|
||||||
|
|
@ -115,7 +115,7 @@ export const newFile = (optios: {
|
||||||
}, (responseHPath) => {
|
}, (responseHPath) => {
|
||||||
fetchPost("/api/filetree/createDocWithMd", {
|
fetchPost("/api/filetree/createDocWithMd", {
|
||||||
notebook: optios.notebookId,
|
notebook: optios.notebookId,
|
||||||
path: pathPosix().join(responseHPath.data, data.data.path, optios.name || ""),
|
path: pathPosix().join(responseHPath.data, data.data.path, optios.name || (data.data.path.endsWith("/") ? "Untitled" : "")),
|
||||||
parentID: getDisplayName(optios.currentPath, true, true),
|
parentID: getDisplayName(optios.currentPath, true, true),
|
||||||
markdown: ""
|
markdown: ""
|
||||||
}, response => {
|
}, response => {
|
||||||
|
|
@ -132,8 +132,7 @@ export const newFile = (optios: {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let title = data.data.path || "Untitled";
|
const title = pathPosix().basename(data.data.path || "Untitled");
|
||||||
title = title.substring(title.lastIndexOf("/") + 1);
|
|
||||||
if (!validateName(title)) {
|
if (!validateName(title)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue