import { addNewWorkspace } from 'actions/workspace' ; import uniqueId from 'lodash/uniqueId' ; import mapValues from 'lodash/mapValues' ; export const keyboardActions = { ADD_NEW_WORKSPACE : ( ) => addNewWorkspace ( { id : uniqueId ( 'workspace_' ) } ) , } ; export const keyMap = { ADD_NEW_WORKSPACE : 'n' , } ; export const createHandlers = ( dispatch ) : KeyboardHandlers => { return mapValues ( keyboardActions , ( actionCreator ) => ( e ) => { dispatch ( actionCreator ( ) ) ; e . stopPropagation ( ) ; e . preventDefault ( ) ; } ) as KeyboardHandlers ; } ;