mirror of
https://gitlab.com/ArkHost/HelixNotes.git
synced 2026-07-24 07:45:57 +02:00
Notebook reorder via pointer-event drag handle (fixes Windows/Android); click body selects, chevron expands
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user