mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-08 05:32:33 +01:00
🎨 Improve #commonMenu menu (#16147)
This commit is contained in:
parent
2c23d05c7c
commit
3922ca0cd4
7 changed files with 17 additions and 11 deletions
|
|
@ -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; // 移除数据
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue