mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 16:40:13 +01:00
🎨
This commit is contained in:
parent
c3d3cb189c
commit
d214aad78e
1 changed files with 11 additions and 3 deletions
|
|
@ -22,7 +22,11 @@ export const newFile = (notebookId?: string, currentPath?: string, paths?: strin
|
||||||
const currentElement = item.parent.headElement;
|
const currentElement = item.parent.headElement;
|
||||||
if (currentElement.classList.contains("item--focus")) {
|
if (currentElement.classList.contains("item--focus")) {
|
||||||
notebookId = item.editor.protyle.notebookId;
|
notebookId = item.editor.protyle.notebookId;
|
||||||
currentPath = pathPosix().dirname(item.editor.protyle.path);
|
if (useSavePath) {
|
||||||
|
currentPath = item.editor.protyle.path;
|
||||||
|
} else {
|
||||||
|
currentPath = pathPosix().dirname(item.editor.protyle.path);
|
||||||
|
}
|
||||||
if (hasClosestByClassName(currentElement, "layout__wnd--active")) {
|
if (hasClosestByClassName(currentElement, "layout__wnd--active")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -38,7 +42,11 @@ export const newFile = (notebookId?: string, currentPath?: string, paths?: strin
|
||||||
notebookId = topElement.getAttribute("data-url");
|
notebookId = topElement.getAttribute("data-url");
|
||||||
}
|
}
|
||||||
const selectPath = currentElement.getAttribute("data-path");
|
const selectPath = currentElement.getAttribute("data-path");
|
||||||
currentPath = pathPosix().dirname(selectPath);
|
if (useSavePath) {
|
||||||
|
currentPath = selectPath;
|
||||||
|
} else {
|
||||||
|
currentPath = pathPosix().dirname(selectPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -55,7 +63,7 @@ export const newFile = (notebookId?: string, currentPath?: string, paths?: strin
|
||||||
}
|
}
|
||||||
fetchPost("/api/filetree/getDocCreateSavePath", {notebook: notebookId}, (data) => {
|
fetchPost("/api/filetree/getDocCreateSavePath", {notebook: notebookId}, (data) => {
|
||||||
if (data.data.path.indexOf("/") > -1 && useSavePath) {
|
if (data.data.path.indexOf("/") > -1 && useSavePath) {
|
||||||
if (data.data.path.startsWith("/")) {
|
if (data.data.path.startsWith("/") || currentPath === "/") {
|
||||||
fetchPost("/api/filetree/createDocWithMd", {
|
fetchPost("/api/filetree/createDocWithMd", {
|
||||||
notebook: notebookId,
|
notebook: notebookId,
|
||||||
path: data.data.path,
|
path: data.data.path,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue