mirror of
https://gitlab.com/ArkHost/HelixNotes.git
synced 2026-07-23 23:35:57 +02:00
Add command-palette entries to reach hidden sidebar views (#153)
This commit is contained in:
@@ -967,7 +967,7 @@
|
||||
{/if}
|
||||
|
||||
<SearchPanel />
|
||||
<CommandPalette />
|
||||
<CommandPalette onNavigate={handleViewChanged} />
|
||||
<SettingsPanel />
|
||||
<InfoPanel />
|
||||
|
||||
|
||||
@@ -3,6 +3,18 @@
|
||||
import { setTheme, reindex } from '$lib/api';
|
||||
import { darkThemes } from '$lib/platform';
|
||||
|
||||
// onNavigate runs the parent's view-change handler (refreshes the note list and reveals it
|
||||
// if it was hidden), so opening a view here behaves exactly like clicking it in the sidebar.
|
||||
let { onNavigate = () => {} }: { onNavigate?: () => void } = $props();
|
||||
|
||||
function openView(mode: 'all' | 'quickaccess' | 'tasks' | 'daily' | 'trash') {
|
||||
$viewMode = mode;
|
||||
$activeNotebook = null;
|
||||
$activeTag = null;
|
||||
$showCommandPalette = false;
|
||||
onNavigate();
|
||||
}
|
||||
|
||||
interface Command {
|
||||
id: string;
|
||||
label: string;
|
||||
@@ -26,15 +38,30 @@
|
||||
$showSearch = true;
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'open-all-notes',
|
||||
label: 'Open All Notes',
|
||||
action: () => openView('all')
|
||||
},
|
||||
{
|
||||
id: 'open-quick-access',
|
||||
label: 'Open Quick Access',
|
||||
action: () => openView('quickaccess')
|
||||
},
|
||||
{
|
||||
id: 'open-tasks',
|
||||
label: 'Open Tasks',
|
||||
action: () => openView('tasks')
|
||||
},
|
||||
{
|
||||
id: 'open-daily',
|
||||
label: 'Open Daily Notes',
|
||||
action: () => openView('daily')
|
||||
},
|
||||
{
|
||||
id: 'open-trash',
|
||||
label: 'Open Trash (restore deleted notes)',
|
||||
action: () => {
|
||||
$viewMode = 'trash';
|
||||
$activeNotebook = null;
|
||||
$activeTag = null;
|
||||
$showCommandPalette = false;
|
||||
}
|
||||
action: () => openView('trash')
|
||||
},
|
||||
{
|
||||
id: 'theme-light',
|
||||
|
||||
Reference in New Issue
Block a user