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

View file

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