Files
standardnotes-app-web/packages/ui-services/src/Keyboard/KeyboardShortcut.ts

29 lines
959 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { Platform } from '@standardnotes/snjs'
import { KeyboardCommand } from './KeyboardCommands'
import { KeyboardKey } from './KeyboardKey'
import { KeyboardModifier } from './KeyboardModifier'
export type KeyboardShortcut = {
command: KeyboardCommand
modifiers?: KeyboardModifier[]
key?: KeyboardKey | string
/**
* Alternative to using key, if the key can be affected by alt + shift. For example, if you want alt + shift + n,
* use code 'KeyN' instead of key 'n', as the modifiers would turn n into '˜' on Mac.
*/
code?: string
preventDefault?: boolean
}
export type PlatformedKeyboardShortcut = KeyboardShortcut & {
platform: Platform
}
export type KeyboardShortcutCategory = 'General' | 'Notes list' | 'Current note' | 'Super notes' | 'Formatting'
export type KeyboardShortcutHelpItem = Omit<PlatformedKeyboardShortcut, 'command'> & {
command?: KeyboardCommand
category: KeyboardShortcutCategory
description: string
}