mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 08:30:12 +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) => {
|
||||
fetchPost("/api/notebook/getNotebookConf", {
|
||||
fetchPost("/api/filetree/getRefCreateSavePath", {
|
||||
notebook: notebookId
|
||||
}, (data) => {
|
||||
let savePath = data.data.conf.refCreateSavePath;
|
||||
if (!savePath) {
|
||||
savePath = window.siyuan.config.fileTree.refCreateSavePath;
|
||||
}
|
||||
if (savePath) {
|
||||
if (savePath.startsWith("/")) {
|
||||
cb(getDisplayName(savePath, false, true));
|
||||
if (data.data.path) {
|
||||
if (data.data.path.startsWith("/")) {
|
||||
cb(getDisplayName(data.data.path, false, true));
|
||||
} else {
|
||||
fetchPost("/api/filetree/getHPathByPath", {
|
||||
notebook: notebookId,
|
||||
path: pathString
|
||||
}, (response) => {
|
||||
cb(getDisplayName(pathPosix().join(response.data, savePath), false, true));
|
||||
cb(getDisplayName(pathPosix().join(response.data, data.data.path), false, true));
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue