mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-19 08:00:13 +01:00
🚨
This commit is contained in:
parent
d1a2140cd9
commit
8c639f8a16
3 changed files with 6 additions and 7 deletions
|
|
@ -1,7 +1,6 @@
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
import {shell} from "electron";
|
import {shell} from "electron";
|
||||||
/// #endif
|
/// #endif
|
||||||
import {newFile} from "../util/newFile";
|
|
||||||
import {getDockByType} from "../layout/util";
|
import {getDockByType} from "../layout/util";
|
||||||
import {confirmDialog} from "../dialog/confirmDialog";
|
import {confirmDialog} from "../dialog/confirmDialog";
|
||||||
import {getSearch, isMobile} from "../util/functions";
|
import {getSearch, isMobile} from "../util/functions";
|
||||||
|
|
|
||||||
|
|
@ -127,9 +127,9 @@ export const initNavigationMenu = (liElement: HTMLElement) => {
|
||||||
return window.siyuan.menus.menu;
|
return window.siyuan.menus.menu;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const initFileMenu = (notebookId: string, pathString: string, liElement: HTMLElement) => {
|
export const initFileMenu = (notebookId: string, pathString: string, liElement: Element) => {
|
||||||
const id = liElement.getAttribute("data-node-id")
|
const id = liElement.getAttribute("data-node-id");
|
||||||
let name = liElement.getAttribute("data-name")
|
let name = liElement.getAttribute("data-name");
|
||||||
window.siyuan.menus.menu.remove();
|
window.siyuan.menus.menu.remove();
|
||||||
name = getDisplayName(name, false, true);
|
name = getDisplayName(name, false, true);
|
||||||
if (!window.siyuan.config.readonly) {
|
if (!window.siyuan.config.readonly) {
|
||||||
|
|
@ -149,7 +149,7 @@ export const initFileMenu = (notebookId: string, pathString: string, liElement:
|
||||||
Array.from(liElement.parentElement.children).forEach((item) => {
|
Array.from(liElement.parentElement.children).forEach((item) => {
|
||||||
if (item.tagName === "LI") {
|
if (item.tagName === "LI") {
|
||||||
if (item.isSameNode(liElement)) {
|
if (item.isSameNode(liElement)) {
|
||||||
paths.push(undefined)
|
paths.push(undefined);
|
||||||
}
|
}
|
||||||
paths.push(item.getAttribute("data-path"));
|
paths.push(item.getAttribute("data-path"));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,9 +54,9 @@ export const newFile = (notebookId?: string, currentPath?: string, open?: boolea
|
||||||
}
|
}
|
||||||
fetchPost("/api/filetree/getDocNameTemplate", {notebook: notebookId}, (data) => {
|
fetchPost("/api/filetree/getDocNameTemplate", {notebook: notebookId}, (data) => {
|
||||||
const id = Lute.NewNodeID();
|
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) {
|
if (paths) {
|
||||||
paths[paths.indexOf(undefined)] = newPath
|
paths[paths.indexOf(undefined)] = newPath;
|
||||||
}
|
}
|
||||||
fetchPost("/api/filetree/createDoc", {
|
fetchPost("/api/filetree/createDoc", {
|
||||||
notebook: notebookId,
|
notebook: notebookId,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue