mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-20 19:10:49 +08:00
This commit is contained in:
parent
4b46e2c3d6
commit
7cd8f8f7d0
@ -74,6 +74,7 @@ export class Menu {
|
||||
}
|
||||
|
||||
this.element.innerHTML = "";
|
||||
this.element.removeAttribute("data-filetreeid"); // 用于标记文档数右键所选文档 https://ld246.com/article/1667311960383
|
||||
this.element.classList.add("fn__none");
|
||||
this.element.style.zIndex = "";
|
||||
}
|
||||
|
@ -132,6 +132,7 @@ export const initNavigationMenu = (liElement: HTMLElement) => {
|
||||
}
|
||||
}]
|
||||
}).element);
|
||||
window.siyuan.menus.menu.element.setAttribute("data-filetreeid", notebookId);
|
||||
return window.siyuan.menus.menu;
|
||||
};
|
||||
|
||||
@ -283,6 +284,7 @@ export const initFileMenu = (notebookId: string, pathString: string, liElement:
|
||||
/// #endif
|
||||
genImportMenu(notebookId, pathString);
|
||||
window.siyuan.menus.menu.append(exportMd(id));
|
||||
window.siyuan.menus.menu.element.setAttribute("data-filetreeid", id);
|
||||
return window.siyuan.menus.menu;
|
||||
};
|
||||
|
||||
|
@ -865,7 +865,20 @@ const fileTreeKeydown = (event: KeyboardEvent) => {
|
||||
if (!files.element.parentElement.classList.contains("layout__tab--active")) {
|
||||
return false;
|
||||
}
|
||||
let liElement = files.element.querySelector(".b3-list-item--focus");
|
||||
let liElement
|
||||
const menuId = window.siyuan.menus.menu.element.getAttribute("data-filetreeid")
|
||||
if (menuId) {
|
||||
liElement = files.element.querySelector(`li[data-node-id="${menuId}"]`)
|
||||
if (!liElement) {
|
||||
liElement = files.element.querySelector(`ul[data-url="${menuId}"] > li`)
|
||||
}
|
||||
if (!liElement) {
|
||||
return;
|
||||
}
|
||||
window.siyuan.menus.menu.remove();
|
||||
} else {
|
||||
liElement = files.element.querySelector(".b3-list-item--focus");
|
||||
}
|
||||
if (!liElement) {
|
||||
if (event.key.startsWith("Arrow")) {
|
||||
liElement = files.element.querySelector(".b3-list-item");
|
||||
@ -1020,7 +1033,6 @@ const fileTreeKeydown = (event: KeyboardEvent) => {
|
||||
return true;
|
||||
}
|
||||
if (event.key === "Delete" || (event.key === "Backspace" && isMac())) {
|
||||
window.siyuan.menus.menu.remove();
|
||||
if (isFile) {
|
||||
deleteFile(notebookId, pathString, getDisplayName(liElement.getAttribute("data-name"), false, true));
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user