Skip to content

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

:art: fix https://github.com/siyuan-note/siyuan/issues/9224

Vanessa8e42b15db3db
diff --git a/app/src/dialog/message.ts b/app/src/dialog/message.ts
index 95748ffafa..069773ddbb 100644
--- a/app/src/dialog/message.ts
+++ b/app/src/dialog/message.ts
@@ -34,10 +34,14 @@ export const initMessage = () => {
// type: info/error; timeout: 0 手动关闭;-1 用不关闭
export const showMessage = (message: string, timeout = 6000, type = "info", messageId?: string) => {
- const messageVersion = message + (type === "error" ? " v" + Constants.SIYUAN_VERSION : "");
- const id = messageId || genUUID();
const messagesElement = document.getElementById("message").firstElementChild;
+ if (!messagesElement) {
+ alert(message);
+ return ;
+ }
+ const id = messageId || genUUID();
const existElement = messagesElement.querySelector(`.b3-snackbar[data-id="${id}"]`);
+ const messageVersion = message + (type === "error" ? " v" + Constants.SIYUAN_VERSION : "");
if (existElement) {
window.clearTimeout(parseInt(existElement.getAttribute("data-timeoutid")));
existElement.innerHTML = `<div class="b3-snackbar__content${timeout === 0 ? " b3-snackbar__content--close" : ""}">${messageVersion}</div>${timeout === 0 ? '<svg class="b3-snackbar__close"><use xlink:href="#iconCloseRound"></use></svg>' : ""}`;