mirror of
https://github.com/R0m1k3/noteflow.git
synced 2026-10-11 17:29:37 +02:00
Merge pull request #148 from R0m1k3/claude/statistics-modal-popup-01P7c6z7G5KXo9Tk6BwEa4ew
fix: permettre les espaces dans les titres des notes
This commit is contained in:
1 file changed
+13
@@ -22,6 +22,13 @@ export function useKeyboardShortcuts(
|
||||
if (!enabled) return;
|
||||
|
||||
const handleKeyDown = (event: KeyboardEvent) => {
|
||||
// Ignore keyboard shortcuts when typing in input fields, textareas, or contentEditable elements
|
||||
// UNLESS the shortcut has a modifier key (Ctrl, Alt, Meta)
|
||||
const target = event.target as HTMLElement;
|
||||
const isInputField = target.tagName === 'INPUT' ||
|
||||
target.tagName === 'TEXTAREA' ||
|
||||
target.isContentEditable;
|
||||
|
||||
for (const shortcut of shortcuts) {
|
||||
const keyMatch = event.key.toLowerCase() === shortcut.key.toLowerCase();
|
||||
const ctrlMatch = shortcut.ctrl ? (event.ctrlKey || event.metaKey) : !event.ctrlKey && !event.metaKey;
|
||||
@@ -30,6 +37,12 @@ export function useKeyboardShortcuts(
|
||||
const metaMatch = shortcut.meta ? event.metaKey : !event.metaKey;
|
||||
|
||||
if (keyMatch && ctrlMatch && altMatch && shiftMatch && metaMatch) {
|
||||
// Skip shortcuts without modifiers when user is typing in input fields
|
||||
const hasModifier = shortcut.ctrl || shortcut.alt || shortcut.meta;
|
||||
if (isInputField && !hasModifier) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (shortcut.preventDefault !== false) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user