mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 00:50:13 +01:00
This commit is contained in:
parent
201fc51f32
commit
18b9faa6dc
1 changed files with 5 additions and 9 deletions
|
|
@ -79,22 +79,18 @@ export const newFile = (notebookId?: string, currentPath?: string, open?: boolea
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getSavePath = (pathString: string, notebookId: string, cb: (p: string) => void) => {
|
export const getSavePath = (pathString: string, notebookId: string, cb: (p: string) => void) => {
|
||||||
fetchPost("/api/notebook/getNotebookConf", {
|
fetchPost("/api/filetree/getRefCreateSavePath", {
|
||||||
notebook: notebookId
|
notebook: notebookId
|
||||||
}, (data) => {
|
}, (data) => {
|
||||||
let savePath = data.data.conf.refCreateSavePath;
|
if (data.data.path) {
|
||||||
if (!savePath) {
|
if (data.data.path.startsWith("/")) {
|
||||||
savePath = window.siyuan.config.fileTree.refCreateSavePath;
|
cb(getDisplayName(data.data.path, false, true));
|
||||||
}
|
|
||||||
if (savePath) {
|
|
||||||
if (savePath.startsWith("/")) {
|
|
||||||
cb(getDisplayName(savePath, false, true));
|
|
||||||
} else {
|
} else {
|
||||||
fetchPost("/api/filetree/getHPathByPath", {
|
fetchPost("/api/filetree/getHPathByPath", {
|
||||||
notebook: notebookId,
|
notebook: notebookId,
|
||||||
path: pathString
|
path: pathString
|
||||||
}, (response) => {
|
}, (response) => {
|
||||||
cb(getDisplayName(pathPosix().join(response.data, savePath), false, true));
|
cb(getDisplayName(pathPosix().join(response.data, data.data.path), false, true));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue