diff --git a/app/src/block/Panel.ts b/app/src/block/Panel.ts index c1087d705..77721ac2c 100644 --- a/app/src/block/Panel.ts +++ b/app/src/block/Panel.ts @@ -228,7 +228,7 @@ export class BlockPanel { this.targetElement = undefined; // 移除弹出上使用右键菜单 const menuLevel = parseInt(window.siyuan.menus.menu.element.dataset.from); - if (menuLevel && menuLevel >= level && window.siyuan.menus.menu.element.dataset.from.includes("popover")) { + if (menuLevel && menuLevel >= level && window.siyuan.menus.menu.element.dataset.from?.includes("popover")) { // https://github.com/siyuan-note/siyuan/issues/9854 右键菜单不是从浮窗中弹出的则不进行移除 window.siyuan.menus.menu.remove(); } diff --git a/app/src/constants.ts b/app/src/constants.ts index aed6de001..a4c7bd26b 100644 --- a/app/src/constants.ts +++ b/app/src/constants.ts @@ -244,7 +244,7 @@ export abstract class Constants { public static readonly MENU_DOC_TREE_MORE = "docTreeMore"; // 侧栏文档树右键菜单 public static readonly MENU_FROM_DOC_TREE_MORE_NOTEBOOK = "tree-notebook"; // 侧栏文档树右键菜单,单个笔记本 public static readonly MENU_FROM_DOC_TREE_MORE_DOC = "tree-doc"; // 侧栏文档树右键菜单,单个文档 - public static readonly MENU_FROM_DOC_TREE_MORE_DOCS = "tree-docs"; // 侧栏文档树右键菜单,多个文档 + public static readonly MENU_FROM_DOC_TREE_MORE_ITEMS = "tree-items"; // 侧栏文档树右键菜单,多个文档或笔记本 public static readonly MENU_TAG = "tagMenu"; // 侧栏标签菜单 public static readonly MENU_BOOKMARK = "bookmarkMenu"; // 侧栏书签菜单 public static readonly MENU_OUTLINE_CONTEXT = "outline-context"; // 大纲标题右键菜单 diff --git a/app/src/menus/navigation.ts b/app/src/menus/navigation.ts index aa3ec72d8..96d5e5414 100644 --- a/app/src/menus/navigation.ts +++ b/app/src/menus/navigation.ts @@ -32,7 +32,7 @@ import {openByMobile} from "../protyle/util/compatibility"; import {addFilesToDatabase} from "../protyle/render/av/addToDatabase"; const initMultiMenu = (selectItemElements: NodeListOf, app: App) => { - window.siyuan.menus.menu.element.setAttribute("data-from", Constants.MENU_FROM_DOC_TREE_MORE_DOCS); + window.siyuan.menus.menu.element.setAttribute("data-from", Constants.MENU_FROM_DOC_TREE_MORE_ITEMS); const fileItemElement = Array.from(selectItemElements).find(item => { if (item.getAttribute("data-type") === "navigation-file") { return true; @@ -204,9 +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); } + 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); if (!window.siyuan.config.readonly) {