fix: The shortcut for displaying the keyboard shortcut help dialog has been changed to Ctrl + /

This commit is contained in:
Aman Harwara
2024-01-28 22:32:32 +05:30
parent 865ebe58d3
commit 5a49005e79
4 changed files with 8 additions and 3 deletions

View File

@@ -194,6 +194,10 @@ export class KeyboardService {
const helpItem = this.getKeyboardShortcutHelpItemForHandler(observer) const helpItem = this.getKeyboardShortcutHelpItemForHandler(observer)
if (helpItem) { if (helpItem) {
const existingItem = Array.from(this.keyboardShortcutHelpItems).find((item) => item.command === helpItem.command)
if (existingItem) {
this.keyboardShortcutHelpItems.delete(existingItem)
}
this.keyboardShortcutHelpItems.add(helpItem) this.keyboardShortcutHelpItems.add(helpItem)
} }

View File

@@ -22,6 +22,7 @@ export type PlatformedKeyboardShortcut = KeyboardShortcut & {
export type KeyboardShortcutCategory = 'General' | 'Notes list' | 'Current note' | 'Super notes' | 'Formatting' export type KeyboardShortcutCategory = 'General' | 'Notes list' | 'Current note' | 'Super notes' | 'Formatting'
export type KeyboardShortcutHelpItem = Omit<PlatformedKeyboardShortcut, 'command'> & { export type KeyboardShortcutHelpItem = Omit<PlatformedKeyboardShortcut, 'command'> & {
command?: KeyboardCommand
category: KeyboardShortcutCategory category: KeyboardShortcutCategory
description: string description: string
} }

View File

@@ -195,9 +195,8 @@ export function getKeyboardShortcuts(platform: Platform, _environment: Environme
}, },
{ {
command: TOGGLE_KEYBOARD_SHORTCUTS_MODAL, command: TOGGLE_KEYBOARD_SHORTCUTS_MODAL,
key: '?', key: '/',
preventDefault: true, modifiers: [primaryModifier],
modifiers: [KeyboardModifier.Shift],
}, },
] ]
} }

View File

@@ -48,6 +48,7 @@ const KeyboardShortcutsModal = ({ keyboardService }: { keyboardService: Keyboard
useEffect(() => { useEffect(() => {
return keyboardService.addCommandHandler({ return keyboardService.addCommandHandler({
command: TOGGLE_KEYBOARD_SHORTCUTS_MODAL, command: TOGGLE_KEYBOARD_SHORTCUTS_MODAL,
category: 'General',
description: 'Toggle keyboard shortcuts help', description: 'Toggle keyboard shortcuts help',
onKeyDown: () => { onKeyDown: () => {
setItems(createGroupedItems(keyboardService.getRegisteredKeyboardShorcutHelpItems())) setItems(createGroupedItems(keyboardService.getRegisteredKeyboardShorcutHelpItems()))