mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 23:50:13 +01:00
This commit is contained in:
parent
4b46e2c3d6
commit
7cd8f8f7d0
3 changed files with 17 additions and 2 deletions
|
|
@ -74,6 +74,7 @@ export class Menu {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.element.innerHTML = "";
|
this.element.innerHTML = "";
|
||||||
|
this.element.removeAttribute("data-filetreeid"); // 用于标记文档数右键所选文档 https://ld246.com/article/1667311960383
|
||||||
this.element.classList.add("fn__none");
|
this.element.classList.add("fn__none");
|
||||||
this.element.style.zIndex = "";
|
this.element.style.zIndex = "";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -132,6 +132,7 @@ export const initNavigationMenu = (liElement: HTMLElement) => {
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
}).element);
|
}).element);
|
||||||
|
window.siyuan.menus.menu.element.setAttribute("data-filetreeid", notebookId);
|
||||||
return window.siyuan.menus.menu;
|
return window.siyuan.menus.menu;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -283,6 +284,7 @@ export const initFileMenu = (notebookId: string, pathString: string, liElement:
|
||||||
/// #endif
|
/// #endif
|
||||||
genImportMenu(notebookId, pathString);
|
genImportMenu(notebookId, pathString);
|
||||||
window.siyuan.menus.menu.append(exportMd(id));
|
window.siyuan.menus.menu.append(exportMd(id));
|
||||||
|
window.siyuan.menus.menu.element.setAttribute("data-filetreeid", id);
|
||||||
return window.siyuan.menus.menu;
|
return window.siyuan.menus.menu;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -865,7 +865,20 @@ const fileTreeKeydown = (event: KeyboardEvent) => {
|
||||||
if (!files.element.parentElement.classList.contains("layout__tab--active")) {
|
if (!files.element.parentElement.classList.contains("layout__tab--active")) {
|
||||||
return false;
|
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 (!liElement) {
|
||||||
if (event.key.startsWith("Arrow")) {
|
if (event.key.startsWith("Arrow")) {
|
||||||
liElement = files.element.querySelector(".b3-list-item");
|
liElement = files.element.querySelector(".b3-list-item");
|
||||||
|
|
@ -1020,7 +1033,6 @@ const fileTreeKeydown = (event: KeyboardEvent) => {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (event.key === "Delete" || (event.key === "Backspace" && isMac())) {
|
if (event.key === "Delete" || (event.key === "Backspace" && isMac())) {
|
||||||
window.siyuan.menus.menu.remove();
|
|
||||||
if (isFile) {
|
if (isFile) {
|
||||||
deleteFile(notebookId, pathString, getDisplayName(liElement.getAttribute("data-name"), false, true));
|
deleteFile(notebookId, pathString, getDisplayName(liElement.getAttribute("data-name"), false, true));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue