keyboard: command palette (Cmd/Ctrl+K)
Fuzzy quick-open overlay: type to jump to any note by title (titles index) or run a command — New note, Go to Board/Graph/Reminders/Archive/Trash, and Open Settings (admins). Arrow keys move the selection, Enter activates, Esc closes; Cmd/Ctrl+K toggles it (works even while typing). Selecting a note navigates to the board with ?open=<id>; BoardView watches that query and opens the editor (fetching the note if it isn't loaded), then clears the param. Added to the ? cheat-sheet. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FRgehjoz7Yv8LkUfADxACm
This commit is contained in:
@@ -5,6 +5,7 @@ import { useSessionStore } from "../stores/session";
|
||||
import { useConfigStore } from "../stores/config";
|
||||
import { useLabelsStore } from "../stores/labels";
|
||||
import { useUiStore } from "../stores/ui";
|
||||
import CommandPalette from "./CommandPalette.vue";
|
||||
import Icon from "./Icon.vue";
|
||||
import LabelsModal from "./LabelsModal.vue";
|
||||
|
||||
@@ -17,11 +18,13 @@ const ui = useUiStore();
|
||||
|
||||
const managing = ref(false);
|
||||
const showShortcuts = ref(false);
|
||||
const paletteOpen = ref(false);
|
||||
const searchInput = ref<HTMLInputElement | null>(null);
|
||||
const searchText = ref(typeof route.query.q === "string" ? route.query.q : "");
|
||||
let searchTimer: ReturnType<typeof setTimeout> | undefined;
|
||||
|
||||
const shortcuts = [
|
||||
{ label: "Command palette", keys: ["⌘/Ctrl", "K"] },
|
||||
{ label: "New note", keys: ["c"] },
|
||||
{ label: "Search", keys: ["/"] },
|
||||
{ label: "Go to Board", keys: ["g", "b"] },
|
||||
@@ -57,6 +60,12 @@ function compose() {
|
||||
// typing in a field (except Esc, which blurs it). `g` starts a two-key jump
|
||||
// (g b / g g / g r) with a short timeout.
|
||||
function onKeydown(e: KeyboardEvent) {
|
||||
// Cmd/Ctrl+K toggles the command palette — works even while typing.
|
||||
if ((e.metaKey || e.ctrlKey) && (e.key === "k" || e.key === "K")) {
|
||||
e.preventDefault();
|
||||
paletteOpen.value = !paletteOpen.value;
|
||||
return;
|
||||
}
|
||||
if (isTyping(e)) {
|
||||
if (e.key === "Escape") (e.target as HTMLElement).blur();
|
||||
return;
|
||||
@@ -238,6 +247,8 @@ async function signOut() {
|
||||
|
||||
<LabelsModal v-if="managing" @close="managing = false" />
|
||||
|
||||
<CommandPalette v-if="paletteOpen" @close="paletteOpen = false" />
|
||||
|
||||
<div
|
||||
v-if="showShortcuts"
|
||||
class="fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4"
|
||||
|
||||
Reference in New Issue
Block a user