 #= require trix/controllers/attachment_editor_controller
 
 {handleEvent, makeElement, tagName} = Trix
+{keyNames} = Trix.InputController
 
 class Trix.AttachmentEditorController extends Trix.BasicObject
   constructor: (@attachmentPiece, @element, @container) ->

    caption = event.target.value
    @delegate?.attachmentEditorDidRequestUpdatingAttachmentWithAttributes?(@attachment, {caption})

  uninstall: ->
    undo() while undo = @undos.pop()
    @delegate?.didUninstallAttachmentEditor(this)

    input.setAttribute("placeholder", Trix.config.lang.attachment.captionPlaceholder)
    input.value = @attachmentPiece.getCaption()

    handleEvent("keydown", onElement: input, withCallback: @didKeyDownCaption)
    handleEvent("change", onElement: input, withCallback: @didChangeCaption)

    figcaption = @element.querySelector("figcaption")
