mirror of
https://gitlab.com/ArkHost/HelixNotes.git
synced 2026-07-24 07:45:57 +02:00
Persist note-list sort mode across restarts; date follows sort + tooltip
This commit is contained in:
@@ -240,6 +240,8 @@ pub struct VaultState {
|
|||||||
pub notebook_sort_mode: String,
|
pub notebook_sort_mode: String,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub notebook_order: std::collections::HashMap<String, i32>,
|
pub notebook_order: std::collections::HashMap<String, i32>,
|
||||||
|
#[serde(default)]
|
||||||
|
pub sort_mode: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for VaultState {
|
impl Default for VaultState {
|
||||||
@@ -252,6 +254,7 @@ impl Default for VaultState {
|
|||||||
collapsed_notebooks: Vec::new(),
|
collapsed_notebooks: Vec::new(),
|
||||||
notebook_sort_mode: String::new(),
|
notebook_sort_mode: String::new(),
|
||||||
notebook_order: std::collections::HashMap::new(),
|
notebook_order: std::collections::HashMap::new(),
|
||||||
|
sort_mode: String::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
tags,
|
tags,
|
||||||
notes,
|
notes,
|
||||||
viewMode,
|
viewMode,
|
||||||
|
sortMode,
|
||||||
activeTag,
|
activeTag,
|
||||||
updateAvailable as globalUpdateAvailable,
|
updateAvailable as globalUpdateAvailable,
|
||||||
settingsTab,
|
settingsTab,
|
||||||
@@ -184,7 +185,8 @@
|
|||||||
sidebar_collapsed: $sidebarCollapsed,
|
sidebar_collapsed: $sidebarCollapsed,
|
||||||
collapsed_notebooks: $collapsedNotebooks,
|
collapsed_notebooks: $collapsedNotebooks,
|
||||||
notebook_sort_mode: $notebookSortMode,
|
notebook_sort_mode: $notebookSortMode,
|
||||||
notebook_order: $notebookOrder
|
notebook_order: $notebookOrder,
|
||||||
|
sort_mode: $sortMode
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
await saveVaultState(state);
|
await saveVaultState(state);
|
||||||
@@ -421,6 +423,11 @@
|
|||||||
persistState();
|
persistState();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
$sortMode;
|
||||||
|
persistState();
|
||||||
|
});
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
let lastNotePath: string | null = null;
|
let lastNotePath: string | null = null;
|
||||||
try {
|
try {
|
||||||
@@ -431,6 +438,7 @@
|
|||||||
$collapsedNotebooks = state.collapsed_notebooks ?? [];
|
$collapsedNotebooks = state.collapsed_notebooks ?? [];
|
||||||
$notebookSortMode = state.notebook_sort_mode === 'manual' ? 'manual' : 'alphabetical';
|
$notebookSortMode = state.notebook_sort_mode === 'manual' ? 'manual' : 'alphabetical';
|
||||||
$notebookOrder = state.notebook_order ?? {};
|
$notebookOrder = state.notebook_order ?? {};
|
||||||
|
if (state.sort_mode === 'created' || state.sort_mode === 'title' || state.sort_mode === 'modified') $sortMode = state.sort_mode;
|
||||||
lastNotePath = state.last_open_note ?? null;
|
lastNotePath = state.last_open_note ?? null;
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
|
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ export interface VaultState {
|
|||||||
collapsed_notebooks: string[];
|
collapsed_notebooks: string[];
|
||||||
notebook_sort_mode?: string;
|
notebook_sort_mode?: string;
|
||||||
notebook_order?: Record<string, number>;
|
notebook_order?: Record<string, number>;
|
||||||
|
sort_mode?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SearchResult {
|
export interface SearchResult {
|
||||||
|
|||||||
Reference in New Issue
Block a user