 
   addHotkey: (hotkey, callback) ->
     hotkey = if _.isObject(hotkey) then _.clone(hotkey) else { key: hotkey }
-    hotkey.key = hotkey.key.toUpperCase().charCodeAt(0) if _.isString(hotkey.key)
     hotkey.callback = callback
     @hotkeys[hotkey.key] ?= []
     @hotkeys[hotkey.key].push(hotkey)


  _initListeners: ->
    DOM.addEventListener(@editorContainer, 'keydown', (event) =>
      if @hotkeys[event.which]?
        prevent = false
        range = @quill.getSelection()
        if range?   # Should only not be the case if keydown was programmatically triggered
          _.each(@hotkeys[event.which], (hotkey) =>
            return if hotkey.meta? and (event.metaKey != hotkey.meta and event.ctrlKey != hotkey.meta)
            return if hotkey.shift? and event.shiftKey != hotkey.shift
            prevent = hotkey.callback(range) == false or prevent
          )
      return !prevent
    )



class Keyboard
  @hotkeys:
    BOLD:       { key: 'B',          metaKey: true }
    INDENT:     { key: DOM.KEYS.TAB, shiftKey: false }
    ITALIC:     { key: 'I',          metaKey: true }
    OUTDENT:    { key: DOM.KEYS.TAB, shiftKey: true }
    UNDERLINE:  { key: 'U',          metaKey: true }
    UNDO:       { key: 'Z',          metaKey: true, shiftKey: false }
    REDO:       { key: 'Z',          metaKey: true, shiftKey: true }

  @NAVIGATION: [DOM.KEYS.UP, DOM.KEYS.DOWN, DOM.KEYS.LEFT, DOM.KEYS.RIGHT]

