Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: menu

Vanessaa3af4cf72245
diff --git a/app/src/layout/topBar.ts b/app/src/layout/topBar.ts
index e5be2725d7..f871e24bb6 100644
--- a/app/src/layout/topBar.ts
+++ b/app/src/layout/topBar.ts
@@ -94,11 +94,6 @@ export const initBar = (app: App) => {
} else {
toolbarElement.dispatchEvent(new CustomEvent("click", {detail: itemId}));
}
- if (!window.siyuan.menus.menu.element.classList.contains("fn__none") &&
- window.siyuan.menus.menu.element.getAttribute("data-name") === "barmore") {
- return false;
- }
- return true;
}
}).element);
});
diff --git a/app/src/menus/Menu.ts b/app/src/menus/Menu.ts
index e744835c54..8e2f4014c1 100644
--- a/app/src/menus/Menu.ts
+++ b/app/src/menus/Menu.ts
@@ -179,11 +179,11 @@ export class MenuItem {
if (this.element.getAttribute("disabled")) {
return;
}
- const result = options.click(this.element);
+ options.click(this.element);
event.preventDefault();
event.stopImmediatePropagation();
event.stopPropagation();
- if (typeof result === "undefined" || !result) {
+ if (this.element.parentElement) {
window.siyuan.menus.menu.remove();
}
});
diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts
index 51c34c2a71..658122a713 100644
--- a/app/src/types/index.d.ts
+++ b/app/src/types/index.d.ts
@@ -724,7 +724,7 @@ declare interface IModels {
declare interface IMenu {
label?: string,
- click?: (element: HTMLElement) => boolean | void,
+ click?: (element: HTMLElement) => void,
type?: "separator" | "submenu" | "readonly",
accelerator?: string,
action?: string,