mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 08:30:12 +01:00
This commit is contained in:
parent
6d2ff690b2
commit
0d5d63f22a
5 changed files with 14 additions and 2 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue