This commit is contained in:
Vanessa 2022-10-22 17:37:41 +08:00
parent 6d2ff690b2
commit 0d5d63f22a
5 changed files with 14 additions and 2 deletions

View file

@ -9,6 +9,7 @@ import {openFileById} from "../editor/util";
import {fetchPost} from "./fetch";
import {getDisplayName, getOpenNotebookCount, pathPosix} from "./pathName";
import {Constants} from "../constants";
import {validateName} from "../editor/rename";
export const newFile = (notebookId?: string, currentPath?: string, open?: boolean, paths?: string[]) => {
if (getOpenNotebookCount() === 0) {
@ -58,6 +59,9 @@ export const newFile = (notebookId?: string, currentPath?: string, open?: boolea
if (paths) {
paths[paths.indexOf(undefined)] = newPath;
}
if (!validateName(data.data.name)) {
return;
}
fetchPost("/api/filetree/createDoc", {
notebook: notebookId,
path: newPath,