Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/10046

Vanessa594f2935dd16
diff --git a/app/src/boot/globalEvent/click.ts b/app/src/boot/globalEvent/click.ts
index 3a51e10a39..d8026ca6bd 100644
--- a/app/src/boot/globalEvent/click.ts
+++ b/app/src/boot/globalEvent/click.ts
@@ -8,7 +8,9 @@ import {showMessage} from "../../dialog/message";
export const globalClick = (event: MouseEvent & { target: HTMLElement }) => {
if (!window.siyuan.menus.menu.element.contains(event.target) && !hasClosestByAttribute(event.target, "data-menu", "true")) {
if (getSelection().rangeCount > 0 && window.siyuan.menus.menu.element.contains(getSelection().getRangeAt(0).startContainer) &&
- window.siyuan.menus.menu.element.contains(document.activeElement)) {
+ window.siyuan.menus.menu.element.contains(document.activeElement) &&
+ // 点击题头图菜单无法消失
+ !event.target.parentElement?.classList.contains("protyle-background__img")) {
// https://ld246.com/article/1654567749834/comment/1654589171218#comments
} else {
window.siyuan.menus.menu.remove();
diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts
index 0e34eb04a0..3cc474be79 100644
--- a/app/src/menus/protyle.ts
+++ b/app/src/menus/protyle.ts
@@ -87,8 +87,10 @@ const renderAssetList = (element: Element, k: string, position: IPosition, exts:
};
export const assetMenu = (protyle: IProtyle, position: IPosition, callback?: (url: string) => void, exts?: string[]) => {
- window.siyuan.menus.menu.remove();
- const menu = new Menu();
+ const menu = new Menu("background-asset");
+ if (menu.isOpen) {
+ return;
+ }
menu.addItem({
iconHTML: "",
type: "readonly",
diff --git a/app/src/plugin/Menu.ts b/app/src/plugin/Menu.ts
index 5e97a24488..bdebb40602 100644
--- a/app/src/plugin/Menu.ts
+++ b/app/src/plugin/Menu.ts
@@ -18,7 +18,7 @@ export class Menu {
}
this.menu.remove();
if (!this.isOpen) {
- this.menu.element.setAttribute("data-name", id);
+ this.menu.element.setAttribute("data-name", id || "");
this.menu.removeCB = closeCB;
}
}