fix: hover transparent + auto-save éditeur 2s

This commit is contained in:
Bruno Charest 2026-05-30 20:36:13 -04:00
parent 1352818b25
commit a662a4a3c2
2 changed files with 10 additions and 3 deletions

View File

@ -122,7 +122,7 @@ function createMenu(items, parentEl) {
}
});
el.addEventListener('mouseleave', (e) => {
el.style.background = '';
el.style.background = 'transparent';
});
el.addEventListener('click', (e) => {
e.stopPropagation();
@ -172,7 +172,7 @@ function createSubMenu(items, parentEl) {
});
el.innerHTML = item.label;
el.addEventListener('mouseenter', () => { el.style.background = 'rgba(255,255,255,0.06)'; });
el.addEventListener('mouseleave', () => { el.style.background = ''; });
el.addEventListener('mouseleave', () => { el.style.background = 'transparent'; });
el.addEventListener('click', (e) => {
e.stopPropagation();
if (item.action) item.action();
@ -382,7 +382,7 @@ function createDropdownBtn(text, items) {
createMenu(items, btn);
});
btn.addEventListener('mouseenter', () => { btn.style.background = 'rgba(255,255,255,0.08)'; });
btn.addEventListener('mouseleave', () => { btn.style.background = ''; });
btn.addEventListener('mouseleave', () => { btn.style.background = 'transparent'; });
return btn;
}

View File

@ -315,6 +315,13 @@ async function openEditor(vaultName, filePath) {
},
]),
EditorView.lineWrapping,
// Auto-save: debounced save after 2s of inactivity
EditorView.updateListener.of((update) => {
if (update.docChanged) {
clearTimeout(window._obsigateAutoSaveTimer);
window._obsigateAutoSaveTimer = setTimeout(() => saveFile(), 2000);
}
}),
];
// Add language support based on file extension