diff --git a/frontend/js/ai.js b/frontend/js/ai.js
index 98bc72a..b5b6559 100644
--- a/frontend/js/ai.js
+++ b/frontend/js/ai.js
@@ -343,10 +343,11 @@ export async function createAIToolbar(container, getEditorView) {
showToast('AI: sélectionnez du texte à traiter', 'warning');
return;
}
+ showToast('⏳ AI: traitement en cours...', 'info');
try {
const result = await aiAction(endpoint, text, extra);
replaceSelection(v, result, mode);
- showToast('AI: texte traité', 'success');
+ showToast('AI: texte traité ✓', 'success');
} catch (e) {
const msg = String(e.message || e);
if (msg.includes('401')) {
diff --git a/frontend/js/utils.js b/frontend/js/utils.js
index 76a8c48..d82a50c 100644
--- a/frontend/js/utils.js
+++ b/frontend/js/utils.js
@@ -406,6 +406,8 @@ async function waitForCodeMirror() {
}
function closeEditor() {
+ const vault = state.editorVault;
+ const path = state.editorPath;
const modal = document.getElementById("editor-modal");
modal.classList.remove("active");
if (state.editorView) {
@@ -415,6 +417,10 @@ function closeEditor() {
state.fallbackEditorEl = null;
state.editorVault = null;
state.editorPath = null;
+ // Refresh file content if we're viewing the edited file
+ if (vault && path && state.currentVault === vault && state.currentPath === path) {
+ openFile(vault, path);
+ }
}
async function saveFile(silent = false) {
@@ -443,26 +449,27 @@ async function saveFile(silent = false) {
}
if (silent) {
- // Auto-save: brief visual feedback
+ // Auto-save: brief green flash on save button
if (saveBtn) {
+ saveBtn.style.background = '#22c55e';
+ saveBtn.style.color = '#fff';
+ saveBtn.style.borderColor = '#22c55e';
saveBtn.innerHTML = '';
safeCreateIcons();
setTimeout(() => {
- if (saveBtn) saveBtn.innerHTML = originalHTML;
+ if (saveBtn) {
+ saveBtn.style.background = '';
+ saveBtn.style.color = '';
+ saveBtn.style.borderColor = '';
+ saveBtn.innerHTML = originalHTML;
+ }
}, 1500);
}
} else {
saveBtn.innerHTML = '';
safeCreateIcons();
- const _savedVault = state.editorVault;
- const _savedPath = state.editorPath;
- setTimeout(() => {
- closeEditor();
- if (state.currentVault === _savedVault && state.currentPath === _savedPath) {
- openFile(_savedVault, _savedPath);
- }
- }, 800);
+ setTimeout(() => closeEditor(), 800);
}
} catch (err) {
console.error("Save error:", err);