🎨 Improve #commonMenu menu (#16147)

This commit is contained in:
Jeffrey Chen 2025-10-18 22:09:56 +08:00 committed by GitHub
parent 2c23d05c7c
commit 3922ca0cd4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 17 additions and 11 deletions

View file

@ -120,7 +120,7 @@ export class Menu {
this.element.classList.remove("b3-menu--list", "b3-menu--fullscreen");
this.element.removeAttribute("style"); // zIndex
this.element.removeAttribute("data-name"); // 标识再次点击不消失
this.element.removeAttribute("data-from"); // 标识是否在浮窗内打开
this.element.removeAttribute("data-from"); // 标识菜单入口
this.data = undefined; // 移除数据
}

View file

@ -32,6 +32,7 @@ import {openByMobile} from "../protyle/util/compatibility";
import {addFilesToDatabase} from "../protyle/render/av/addToDatabase";
const initMultiMenu = (selectItemElements: NodeListOf<Element>, app: App) => {
window.siyuan.menus.menu.element.setAttribute("data-from", Constants.MENU_FROM_DOC_TREE_MORE_DOCS);
const fileItemElement = Array.from(selectItemElements).find(item => {
if (item.getAttribute("data-type") === "navigation-file") {
return true;
@ -203,6 +204,8 @@ export const initNavigationMenu = (app: App, liElement: HTMLElement) => {
const selectItemElements = fileElement.querySelectorAll(".b3-list-item--focus");
if (selectItemElements.length > 1) {
return initMultiMenu(selectItemElements, app);
} else {
window.siyuan.menus.menu.element.setAttribute("data-from", Constants.MENU_FROM_DOC_TREE_MORE_NOTEBOOK);
}
const notebookId = liElement.parentElement.getAttribute("data-url");
const name = getNotebookName(notebookId);
@ -708,6 +711,7 @@ export const initFileMenu = (app: App, notebookId: string, pathString: string, l
separatorPosition: "top",
});
}
window.siyuan.menus.menu.element.setAttribute("data-from", Constants.MENU_FROM_DOC_TREE_MORE_DOC);
return window.siyuan.menus.menu;
};