UI-tests und fixes aus tests
This commit is contained in:
1 parent
968d980be1
commit
b5e30afd0b
12 files changed
+847
-184
No files matched your search
@@ -206,7 +206,17 @@ document.addEventListener('keydown', e => {
|
||||
if (isDialogOpen()) return;
|
||||
|
||||
if (e.key === 'k' && (e.ctrlKey || e.metaKey)) { e.preventDefault(); search.classList.contains('open') ? closeSearch() : openSearch(); return; }
|
||||
if (e.key === 'n' && (e.ctrlKey || e.metaKey) && !e.shiftKey) {
|
||||
e.preventDefault();
|
||||
const qc = document.getElementById('quick-capture');
|
||||
const qci = document.getElementById('quick-capture-input');
|
||||
if (qc.classList.contains('hidden')) { qc.classList.remove('hidden'); qci.focus(); }
|
||||
else { qc.classList.add('hidden'); qci.value = ''; }
|
||||
return;
|
||||
}
|
||||
if (e.key === 'Escape') {
|
||||
const qc = document.getElementById('quick-capture');
|
||||
if (!qc.classList.contains('hidden')) { qc.classList.add('hidden'); document.getElementById('quick-capture-input').value = ''; return; }
|
||||
if (detail.classList.contains('open')) closeDetail();
|
||||
else if (modal.classList.contains('open')) closeModal();
|
||||
else if (search.classList.contains('open')) closeSearch();
|
||||
@@ -229,6 +239,40 @@ document.addEventListener('keydown', e => {
|
||||
}
|
||||
});
|
||||
|
||||
// ── Quick Capture ──
|
||||
|
||||
document.getElementById('quick-capture-input')?.addEventListener('keydown', async e => {
|
||||
if (e.key === 'Escape') {
|
||||
e.stopPropagation();
|
||||
document.getElementById('quick-capture').classList.add('hidden');
|
||||
e.target.value = '';
|
||||
return;
|
||||
}
|
||||
if (e.key !== 'Enter') return;
|
||||
const title = e.target.value.trim();
|
||||
if (!title) return;
|
||||
e.preventDefault();
|
||||
|
||||
// Split: first line = title, rest = body
|
||||
const lines = title.split(/\n/);
|
||||
const cardTitle = lines[0];
|
||||
let body = lines.slice(1).join('\n').trim();
|
||||
if (!body.includes('#inbox')) body = (body ? body + '\n\n' : '') + '#inbox';
|
||||
|
||||
await api('api/cards', { method: 'POST', body: { title: cardTitle, body, color: '#38bdf8', position: -1 } });
|
||||
|
||||
e.target.value = '';
|
||||
document.getElementById('quick-capture').classList.add('hidden');
|
||||
await window._reloadAll();
|
||||
|
||||
// Toast
|
||||
const n = document.createElement('div');
|
||||
n.style.cssText = 'position:fixed;bottom:60px;right:16px;z-index:200;background:var(--t-surface);border:1px solid var(--t-accent);border-radius:4px;padding:10px 14px;box-shadow:0 4px 20px rgba(0,0,0,0.4);';
|
||||
n.innerHTML = `<div style="font-family:var(--t-font-pixel);font-size:10px;color:var(--t-accent);display:flex;align-items:center;gap:6px;"><i class="ph ph-lightning"></i>captured: ${cardTitle.substring(0, 40)}</div>`;
|
||||
document.body.appendChild(n);
|
||||
setTimeout(() => { n.style.transition = 'opacity .3s'; n.style.opacity = '0'; setTimeout(() => n.remove(), 350); }, 2500);
|
||||
});
|
||||
|
||||
// ── Boot ──
|
||||
|
||||
checkAuth();
|
||||
|
||||
Reference in new issue
Block a user