     compositionend: (event) ->
       @composing = false
 
+  toggleAttributeIfSupported: (attributeName) ->
+    if attributeName in Trix.getAllAttributeNames()
+      @delegate?.inputControllerWillPerformFormatting()
+      @responder?.toggleCurrentAttribute(attributeName)
+
+  activateAttributeIfSupported: (attributeName, value) ->
+    if attributeName in Trix.getAllAttributeNames()
+      @delegate?.inputControllerWillPerformFormatting()
+      @responder?.setCurrentAttribute(attributeName, value)
+
   # https://www.w3.org/TR/input-events-2/#interface-InputEvent-Attributes
 
   deleteByComposition: (event) ->

    @responder?.insertString("\n")

  # insertLink: (event) ->
  #
  # insertOrderedList: (event) ->

  insertParagraph: (event) ->
    @delegate?.inputControllerWillPerformTyping()

    @responder?.insertString(event.data)

  # insertTranspose: (event) ->

  insertUnorderedList: (event) ->
    event.preventDefault()
    @toggleAttributeIfSupported("bullet")

updateSelectionForEvent = (event) ->
  if domRange = getDOMRangeForEvent(event)
