diff --git a/app/src/menus/commonMenuItem.ts b/app/src/menus/commonMenuItem.ts index 8573eb9f7..9b3ee8d4c 100644 --- a/app/src/menus/commonMenuItem.ts +++ b/app/src/menus/commonMenuItem.ts @@ -1,7 +1,6 @@ /// #if !BROWSER import {shell} from "electron"; /// #endif -import {newFile} from "../util/newFile"; import {getDockByType} from "../layout/util"; import {confirmDialog} from "../dialog/confirmDialog"; import {getSearch, isMobile} from "../util/functions"; diff --git a/app/src/menus/navigation.ts b/app/src/menus/navigation.ts index 15eb4f527..df6ea4e0a 100644 --- a/app/src/menus/navigation.ts +++ b/app/src/menus/navigation.ts @@ -127,9 +127,9 @@ export const initNavigationMenu = (liElement: HTMLElement) => { return window.siyuan.menus.menu; }; -export const initFileMenu = (notebookId: string, pathString: string, liElement: HTMLElement) => { - const id = liElement.getAttribute("data-node-id") - let name = liElement.getAttribute("data-name") +export const initFileMenu = (notebookId: string, pathString: string, liElement: Element) => { + const id = liElement.getAttribute("data-node-id"); + let name = liElement.getAttribute("data-name"); window.siyuan.menus.menu.remove(); name = getDisplayName(name, false, true); if (!window.siyuan.config.readonly) { @@ -149,7 +149,7 @@ export const initFileMenu = (notebookId: string, pathString: string, liElement: Array.from(liElement.parentElement.children).forEach((item) => { if (item.tagName === "LI") { if (item.isSameNode(liElement)) { - paths.push(undefined) + paths.push(undefined); } paths.push(item.getAttribute("data-path")); } diff --git a/app/src/util/newFile.ts b/app/src/util/newFile.ts index 348f4be14..8330bb59b 100644 --- a/app/src/util/newFile.ts +++ b/app/src/util/newFile.ts @@ -54,9 +54,9 @@ export const newFile = (notebookId?: string, currentPath?: string, open?: boolea } fetchPost("/api/filetree/getDocNameTemplate", {notebook: notebookId}, (data) => { const id = Lute.NewNodeID(); - const newPath = pathPosix().join(getDisplayName(currentPath, false, true), id + ".sy") + const newPath = pathPosix().join(getDisplayName(currentPath, false, true), id + ".sy"); if (paths) { - paths[paths.indexOf(undefined)] = newPath + paths[paths.indexOf(undefined)] = newPath; } fetchPost("/api/filetree/createDoc", { notebook: notebookId,