Arrow up/down to navigate entries, Enter to open selected for editing
This commit is contained in:
@@ -1409,6 +1409,30 @@ document.addEventListener('keydown', function(e) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Arrow up/down — navigate entries in vault
|
||||||
|
if ((e.key === 'ArrowUp' || e.key === 'ArrowDown') && !isInput && document.getElementById('authSection').classList.contains('hidden')) {
|
||||||
|
e.preventDefault();
|
||||||
|
const filtered = getFilteredEntries();
|
||||||
|
if (!filtered.length) return;
|
||||||
|
let idx = -1;
|
||||||
|
if (selectedIds.size > 0) {
|
||||||
|
const firstId = [...selectedIds][0];
|
||||||
|
idx = filtered.findIndex(e => e.id == firstId);
|
||||||
|
}
|
||||||
|
if (e.key === 'ArrowDown') idx = idx < filtered.length - 1 ? idx + 1 : 0;
|
||||||
|
else idx = idx > 0 ? idx - 1 : filtered.length - 1;
|
||||||
|
selectedIds.clear(); selectedIds.add(filtered[idx].id);
|
||||||
|
updateBatchBar(); render(); playSound('click');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enter — open edit for single selected entry
|
||||||
|
if (e.key === 'Enter' && !isInput && selectedIds.size === 1 && document.getElementById('authSection').classList.contains('hidden') && !document.getElementById('editModal').classList.contains('show') && !document.getElementById('addModal').classList.contains('show')) {
|
||||||
|
e.preventDefault();
|
||||||
|
openEdit([...selectedIds][0]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// ? or / to show shortcuts help (only in vault)
|
// ? or / to show shortcuts help (only in vault)
|
||||||
if ((e.key === '?' || e.key === '/') && !isInput) {
|
if ((e.key === '?' || e.key === '/') && !isInput) {
|
||||||
if (!document.getElementById('authSection').classList.contains('hidden')) return;
|
if (!document.getElementById('authSection').classList.contains('hidden')) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user