mirror of
https://gitlab.com/ArkHost/HelixNotes.git
synced 2026-07-24 07:45:57 +02:00
Add command-palette entries to reach hidden sidebar views (#153)
This commit is contained in:
@@ -967,7 +967,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<SearchPanel />
|
<SearchPanel />
|
||||||
<CommandPalette />
|
<CommandPalette onNavigate={handleViewChanged} />
|
||||||
<SettingsPanel />
|
<SettingsPanel />
|
||||||
<InfoPanel />
|
<InfoPanel />
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,18 @@
|
|||||||
import { setTheme, reindex } from '$lib/api';
|
import { setTheme, reindex } from '$lib/api';
|
||||||
import { darkThemes } from '$lib/platform';
|
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 {
|
interface Command {
|
||||||
id: string;
|
id: string;
|
||||||
label: string;
|
label: string;
|
||||||
@@ -26,15 +38,30 @@
|
|||||||
$showSearch = true;
|
$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',
|
id: 'open-trash',
|
||||||
label: 'Open Trash (restore deleted notes)',
|
label: 'Open Trash (restore deleted notes)',
|
||||||
action: () => {
|
action: () => openView('trash')
|
||||||
$viewMode = 'trash';
|
|
||||||
$activeNotebook = null;
|
|
||||||
$activeTag = null;
|
|
||||||
$showCommandPalette = false;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'theme-light',
|
id: 'theme-light',
|
||||||
|
|||||||
Reference in New Issue
Block a user