Notebook reorder via pointer-event drag handle (fixes Windows/Android); click body selects, chevron expands

This commit is contained in:
Yuri Karamian
2026-06-25 13:31:49 +02:00
parent 85ea26b57a
commit 879d2f42c6
+1 -18
View File
@@ -73,12 +73,6 @@
let trashContextMenu = $state<{ x: number; y: number } | null>(null); let trashContextMenu = $state<{ x: number; y: number } | null>(null);
let tagsCollapsed = $state(true); let tagsCollapsed = $state(true);
let deleteConfirm = $state<NotebookEntry | null>(null); let deleteConfirm = $state<NotebookEntry | null>(null);
function expandNotebook(nb: NotebookEntry) {
if ($collapsedNotebooks.includes(nb.path)) {
$collapsedNotebooks = $collapsedNotebooks.filter(p => p !== nb.path);
}
}
function toggleCollapse(nb: NotebookEntry, e: Event) { function toggleCollapse(nb: NotebookEntry, e: Event) {
e.stopPropagation(); e.stopPropagation();
if ($collapsedNotebooks.includes(nb.path)) { if ($collapsedNotebooks.includes(nb.path)) {
@@ -154,22 +148,11 @@
} }
async function selectNotebook(nb: NotebookEntry) { async function selectNotebook(nb: NotebookEntry) {
const hasVisibleChildren = nb.children.length > 0; // Deselect if clicking the already-active notebook; expand/collapse is the chevron's job
const wasCollapsed = $collapsedNotebooks.includes(nb.path);
// Deselect if clicking the already-active notebook
if ($viewMode === 'notebook' && $activeNotebook?.path === nb.path) { if ($viewMode === 'notebook' && $activeNotebook?.path === nb.path) {
if (hasVisibleChildren) {
if (wasCollapsed) {
await expandNotebook(nb);
} else {
$collapsedNotebooks = [...$collapsedNotebooks, nb.path];
}
return;
}
selectAllNotes(); selectAllNotes();
return; return;
} }
if (hasVisibleChildren) await expandNotebook(nb);
$viewMode = 'notebook'; $viewMode = 'notebook';
$activeNotebook = nb; $activeNotebook = nb;
$activeTag = null; $activeTag = null;