Skip to content

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

:art: remove close btn https://github.com/siyuan-note/siyuan/issues/5290

Vanessacb44439d669a
diff --git a/app/src/dialog/index.ts b/app/src/dialog/index.ts
index 1046959e6e..bd2ac75c42 100644
--- a/app/src/dialog/index.ts
+++ b/app/src/dialog/index.ts
@@ -46,9 +46,6 @@ export class Dialog {
}
public destroy() {
- if (this.disableClose) {
- return false;
- }
this.element.remove();
if (this.destroyCallback) {
this.destroyCallback();
@@ -59,7 +56,6 @@ export class Dialog {
return true;
}
});
- return true;
}
public bindInput(inputElement: HTMLInputElement, enterEvent?: () => void) {
diff --git a/app/src/dialog/processSystem.ts b/app/src/dialog/processSystem.ts
index 332e29a056..38f991691b 100644
--- a/app/src/dialog/processSystem.ts
+++ b/app/src/dialog/processSystem.ts
@@ -139,7 +139,6 @@ export const transactionError = (data: { code: number, data: string }) => {
});
});
btnsElement[1].addEventListener("click", () => {
- dialog.destroy();
fetchPost("/api/filetree/refreshFiletree", {});
});
};
diff --git a/app/src/protyle/ui/hideElements.ts b/app/src/protyle/ui/hideElements.ts
index 95950f5682..ea7a492605 100644
--- a/app/src/protyle/ui/hideElements.ts
+++ b/app/src/protyle/ui/hideElements.ts
@@ -3,9 +3,8 @@ export const hideElements = (panels: string[], protyle?: IProtyle) => {
if (!protyle) {
if (panels.includes("dialog")) {
for (let i = 0; i < window.siyuan.dialogs.length; i++) {
- if (window.siyuan.dialogs[i].destroy()) {
- i--;
- }
+ window.siyuan.dialogs[i].destroy()
+ i--;
}
}
return;
diff --git a/app/src/util/globalShortcut.ts b/app/src/util/globalShortcut.ts
index 058c9df7ad..20a53faa5b 100644
--- a/app/src/util/globalShortcut.ts
+++ b/app/src/util/globalShortcut.ts
@@ -287,7 +287,8 @@ export const globalShortcut = () => {
<ul class="b3-list b3-list--background">${tabHtml}</ul>
</div>
<div class="fn__hr"></div>
-</div>`
+</div>`,
+ disableClose: true
});
switchDialog.element.addEventListener(isMac() ? "contextmenu" : "click", (event) => {
event.preventDefault();