From 7105fe0d6dd89ce78083a1dce6f96571b12dc726 Mon Sep 17 00:00:00 2001 From: gramps Date: Mon, 13 Jul 2026 16:05:56 -0700 Subject: [PATCH] fix: toast on save success/failure, skip toast on print --- templates/index.html | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/templates/index.html b/templates/index.html index 7c55016..3b8f3cd 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1529,13 +1529,16 @@ function addMessageToolbar(msgDiv) { saveBtn.innerHTML = '💾'; saveBtn.title = 'Save as .md'; saveBtn.onclick = () => { - const t = getText(); - const blob = new Blob([t], { type: 'text/markdown' }); - const a = document.createElement('a'); - a.href = URL.createObjectURL(blob); - a.download = `caic-response-${Date.now()}.md`; - a.click(); - URL.revokeObjectURL(a.href); + try { + const t = getText(); + const blob = new Blob([t], { type: 'text/markdown' }); + const a = document.createElement('a'); + a.href = URL.createObjectURL(blob); + a.download = `caic-response-${Date.now()}.md`; + a.click(); + URL.revokeObjectURL(a.href); + showToast('Saved'); + } catch(e) { showToast('Save failed'); } }; toolbar.append(copyBtn, printBtn, saveBtn, sep()); if (!msgDiv.classList.contains('search-result')) {