Vanessa 2025-02-09 12:19:38 +08:00
parent 834e42d330
commit 346479a9e8
4 changed files with 17 additions and 8 deletions

View file

@ -308,7 +308,8 @@ export class Files extends Model {
app: options.app, app: options.app,
notebookId, notebookId,
currentPath: pathString, currentPath: pathString,
useSavePath: false useSavePath: false,
pushCreateEvt: true,
}); });
} else if (type === "more-root") { } else if (type === "more-root") {
initNavigationMenu(options.app, target.parentElement).popup({ initNavigationMenu(options.app, target.parentElement).popup({

View file

@ -458,7 +458,8 @@ export const initFileMenu = (app: App, notebookId: string, pathString: string, l
notebookId, notebookId,
currentPath: pathPosix().dirname(pathString), currentPath: pathPosix().dirname(pathString),
paths, paths,
useSavePath: false useSavePath: false,
pushCreateEvt: true,
}); });
} }
}).element); }).element);
@ -481,7 +482,8 @@ export const initFileMenu = (app: App, notebookId: string, pathString: string, l
notebookId, notebookId,
currentPath: pathPosix().dirname(pathString), currentPath: pathPosix().dirname(pathString),
paths, paths,
useSavePath: false useSavePath: false,
pushCreateEvt: true,
}); });
} }
}).element); }).element);

View file

@ -205,7 +205,8 @@ export class MobileFiles extends Model {
app, app,
notebookId, notebookId,
currentPath: pathString, currentPath: pathString,
useSavePath: false useSavePath: false,
pushCreateEvt: true,
}); });
} else if (type === "more-root") { } else if (type === "more-root") {
initNavigationMenu(app, target.parentElement); initNavigationMenu(app, target.parentElement);

View file

@ -81,6 +81,7 @@ export const newFile = (optios: {
useSavePath: boolean, useSavePath: boolean,
name?: string, name?: string,
afterCB?: (id: string, title: string) => void afterCB?: (id: string, title: string) => void
pushCreateEvt?: boolean
}) => { }) => {
if (getOpenNotebookCount() === 0) { if (getOpenNotebookCount() === 0) {
showMessage(window.siyuan.languages.newFileTip); showMessage(window.siyuan.languages.newFileTip);
@ -102,7 +103,8 @@ export const newFile = (optios: {
notebook: data.data.box, notebook: data.data.box,
path: createPath, path: createPath,
// 根目录时无法确定 parentID // 根目录时无法确定 parentID
markdown: "" markdown: "",
pushCreateEvt: optios.pushCreateEvt
}, response => { }, response => {
if (optios.afterCB) { if (optios.afterCB) {
optios.afterCB(response.data, pathPosix().basename(createPath)); optios.afterCB(response.data, pathPosix().basename(createPath));
@ -127,7 +129,8 @@ export const newFile = (optios: {
notebook: data.data.box, notebook: data.data.box,
path: createPath, path: createPath,
parentID: getDisplayName(optios.currentPath, true, true), parentID: getDisplayName(optios.currentPath, true, true),
markdown: "" markdown: "",
pushCreateEvt: optios.pushCreateEvt
}, response => { }, response => {
if (optios.afterCB) { if (optios.afterCB) {
optios.afterCB(response.data, pathPosix().basename(createPath)); optios.afterCB(response.data, pathPosix().basename(createPath));
@ -154,7 +157,8 @@ export const newFile = (optios: {
fetchPost("/api/filetree/createDocWithMd", { fetchPost("/api/filetree/createDocWithMd", {
notebook: data.data.box, notebook: data.data.box,
path: createPath, path: createPath,
markdown: "" markdown: "",
pushCreateEvt: optios.pushCreateEvt
}, response => { }, response => {
if (optios.afterCB) { if (optios.afterCB) {
optios.afterCB(response.data, pathPosix().basename(createPath)); optios.afterCB(response.data, pathPosix().basename(createPath));
@ -182,7 +186,8 @@ export const newFile = (optios: {
path: newPath, path: newPath,
title, title,
md: "", md: "",
sorts: optios.paths sorts: optios.paths,
pushCreateEvt: optios.pushCreateEvt
}, () => { }, () => {
if (optios.afterCB) { if (optios.afterCB) {
optios.afterCB(id, title); optios.afterCB(id, title);