 {defer} = Trix.Helpers
 
 class Trix.InputController
+  pastedFileCount = 0
+
   @keyNames:
     0x08: "backspace"
     0x0D: "return"


    paste: (event) ->
      event.preventDefault()
      if html = event.clipboardData.getData("text/html")
        @delegate?.inputControllerWillPasteText()
        @responder?.insertHTML(html)
      else if string = event.clipboardData.getData("text/plain")
        @delegate?.inputControllerWillPasteText()
        @responder?.insertString(string)

    compositionstart: (event) ->
      @delegate?.inputControllerWillStartComposition?()

        @delegate?.inputControllerWillPerformTyping()
        @responder?.deleteWordBackward()
        event.preventDefault()

  extensionForFile = (file) ->
    file.type?.match(/\/(\w+)$/)?[1]
