Skip to content

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

:bug: update msg

Vanessaac2c973f2bb8
diff --git a/app/src/dialog/message.ts b/app/src/dialog/message.ts
index 8ec9b39b41..62d5508105 100644
--- a/app/src/dialog/message.ts
+++ b/app/src/dialog/message.ts
@@ -32,8 +32,13 @@ export const showMessage = (message: string, timeout = 6000, type = "info", mess
const messagesElement = document.getElementById("message").firstElementChild;
const existElement = messagesElement.querySelector(`.b3-snackbar[data-id="${id}"]`)
if (existElement) {
- existElement.firstElementChild.innerHTML = message;
window.clearTimeout(parseInt(existElement.getAttribute("data-timeoutid")));
+ existElement.innerHTML = `<div class="b3-snackbar__content">${message}</div>${timeout === 0 ? '<svg class="b3-snackbar__close"><use xlink:href="#iconClose"></use></svg>' : ''}`;
+ if (type === "error") {
+ existElement.classList.add("b3-snackbar--error")
+ } else {
+ existElement.classList.remove("b3-snackbar--error")
+ }
if (timeout > 0) {
const timeoutId = window.setTimeout(() => {
hideMessage(id);
@@ -49,7 +54,7 @@ export const showMessage = (message: string, timeout = 6000, type = "info", mess
const timeoutId = window.setTimeout(() => {
hideMessage(id);
}, timeout);
- messageHTML.replace("<div data-id", `<div data-timeoutid="${timeoutId}" data-id`);
+ messageHTML = messageHTML.replace("<div data-id", `<div data-timeoutid="${timeoutId}" data-id`);
}
if (messagesElement.childElementCount === 0) {
messagesElement.parentElement.classList.add("b3-snackbars--show");
diff --git a/app/src/protyle/export/index.ts b/app/src/protyle/export/index.ts
index fc299163df..93553e3f3d 100644
--- a/app/src/protyle/export/index.ts
+++ b/app/src/protyle/export/index.ts
@@ -149,7 +149,7 @@ const getExportPath = (option: { type: string, id: string }, pdfOption?: PrintTo
});
};
-const onExport = (data: IWebSocketData, filePath: string, type: string, pdfOptions?: PrintToPDFOptions, removeAssets?: boolean, msgId?:string) => {
+const onExport = (data: IWebSocketData, filePath: string, type: string, pdfOptions?: PrintToPDFOptions, removeAssets?: boolean, msgId?: string) => {
let themeName = window.siyuan.config.appearance.themeLight;
let mode = 0;
if (["html", "htmlmd"].includes(type) && window.siyuan.config.appearance.mode === 1) {
@@ -342,11 +342,11 @@ pre code {
});
win.destroy();
}).catch((error: string) => {
- showMessage("Export PDF error:" + error, 0);
+ showMessage("Export PDF error:" + error, 0, "error", msgId);
win.destroy();
});
} catch (e) {
- showMessage("Export PDF error:" + e + ". Export HTML and use Chrome's printing function to convert to PDF", 0);
+ showMessage("Export PDF error:" + e + ". Export HTML and use Chrome's printing function to convert to PDF", 0, "error", msgId);
}
}, Math.min(timeout, 10000));
});