import Handler from './Handler' ; import { KeyEvent } from '../utils' ; import { code } from '../constants' ; author salgum1114
 *  class class ShortcutHandler { handler : Handler ; keyEvent : KeyEvent ; constructor ( handler ) { this . handler = handler ; this . keyEvent = handler . keyEvent ; } param { KeyboardEvent } e returns public isEscape = ( e ) => { return e . code === code . ESCAPE && this . keyEvent . esc ; } ; param { KeyboardEvent } e returns public isQ = ( e ) => { return e . code === code . KEY_Q ; } ; param { KeyboardEvent } e returns public isW = ( e ) => { return e . code === code . KEY_W ; } ; param { KeyboardEvent } e returns public isDelete = ( e ) => { return ( e . code === code . BACKSPACE || e . code === code . DELETE ) && this . keyEvent . del ; } ; param { KeyboardEvent } e returns public isArrow = ( e ) => { return e . code . includes ( 'Arrow' ) && this . keyEvent . move ; } ; param { KeyboardEvent } e returns public isCtrlA = ( e ) => { return ( e . ctrlKey || e . metaKey ) && e . code === code . KEY_A && this . keyEvent . all ; } ; param { KeyboardEvent } e returns public isCtrlC = ( e ) => { return ( e . ctrlKey || e . metaKey ) && e . code === code . KEY_C && this . keyEvent . copy ; } ; param { KeyboardEvent } e returns public isCtrlV = ( e ) => { return ( e . ctrlKey || e . metaKey ) && e . code === code . KEY_V && this . keyEvent . paste ; } ; param { KeyboardEvent } e returns public isCtrlZ = ( e ) => { return ( e . ctrlKey || e . metaKey ) && e . code === code . KEY_Z && this . keyEvent . transaction ; } ; param { KeyboardEvent } e returns public isCtrlY = ( e ) => { return ( e . ctrlKey || e . metaKey ) && e . code === code . KEY_Y && this . keyEvent . transaction ; } ; param { KeyboardEvent } e returns public isPlus = ( e ) => { return e . code === code . EQUAL && this . keyEvent . zoom ; } ; param { KeyboardEvent } e returns public isMinus = ( e ) => { return e . code === code . MINUS && this . keyEvent . zoom ; } ; param { KeyboardEvent } e returns public isO = ( e ) => { return e . code === code . KEY_O && this . keyEvent . zoom ; } ; param { KeyboardEvent } e returns public isP = ( e ) => { return e . code === code . KEY_P && this . keyEvent . zoom ; } ; param { KeyboardEvent } e returns public isCtrlX = ( e ) => { return ( e . ctrlKey || e . metaKey ) && e . code === code . KEY_X && this . keyEvent . cut ; } ; } export default ShortcutHandler ;