mirror of
https://gitlab.com/ArkHost/HelixNotes.git
synced 2026-07-24 07:45:57 +02:00
Add customizable keyboard shortcuts
Drive app shortcuts from a central keybindings store (defaults + localStorage overrides). In the Info panel's Shortcuts tab: click a shortcut to rebind, right-click to reset, Esc to cancel; combos already in use are rejected.
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
theme
|
||||
} from '$lib/stores/app';
|
||||
import { readNote } from '$lib/api';
|
||||
import { keybindings, matchAction } from '$lib/keybindings';
|
||||
import type { FileEvent } from '$lib/types';
|
||||
|
||||
let { notePath }: { notePath: string } = $props();
|
||||
@@ -73,13 +74,11 @@
|
||||
}
|
||||
|
||||
function handleKeydown(e: KeyboardEvent) {
|
||||
const mod = e.ctrlKey || e.metaKey;
|
||||
if (mod && !e.shiftKey && e.code === 'KeyS') {
|
||||
const action = matchAction(e, $keybindings);
|
||||
if (action === 'save') {
|
||||
e.preventDefault();
|
||||
editor?.forceSave();
|
||||
return;
|
||||
}
|
||||
if (mod && e.shiftKey && e.code === 'KeyM') {
|
||||
} else if (action === 'toggle-source') {
|
||||
e.preventDefault();
|
||||
$sourceMode = !$sourceMode;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user