fix: toast on save success/failure, skip toast on print
This commit is contained in:
+10
-7
@@ -1529,13 +1529,16 @@ function addMessageToolbar(msgDiv) {
|
|||||||
saveBtn.innerHTML = '💾';
|
saveBtn.innerHTML = '💾';
|
||||||
saveBtn.title = 'Save as .md';
|
saveBtn.title = 'Save as .md';
|
||||||
saveBtn.onclick = () => {
|
saveBtn.onclick = () => {
|
||||||
const t = getText();
|
try {
|
||||||
const blob = new Blob([t], { type: 'text/markdown' });
|
const t = getText();
|
||||||
const a = document.createElement('a');
|
const blob = new Blob([t], { type: 'text/markdown' });
|
||||||
a.href = URL.createObjectURL(blob);
|
const a = document.createElement('a');
|
||||||
a.download = `caic-response-${Date.now()}.md`;
|
a.href = URL.createObjectURL(blob);
|
||||||
a.click();
|
a.download = `caic-response-${Date.now()}.md`;
|
||||||
URL.revokeObjectURL(a.href);
|
a.click();
|
||||||
|
URL.revokeObjectURL(a.href);
|
||||||
|
showToast('Saved');
|
||||||
|
} catch(e) { showToast('Save failed'); }
|
||||||
};
|
};
|
||||||
toolbar.append(copyBtn, printBtn, saveBtn, sep());
|
toolbar.append(copyBtn, printBtn, saveBtn, sep());
|
||||||
if (!msgDiv.classList.contains('search-result')) {
|
if (!msgDiv.classList.contains('search-result')) {
|
||||||
|
|||||||
Reference in New Issue
Block a user