     @_editableNode().focus() if @isMounted()
 
   _onInput: (event) ->
+    @_editableNode().normalize()
     @_setNewSelectionState()
     html = @_unapplyHTMLDisplayFilters(@_editableNode().innerHTML)
     @props.onChange(target: value: html)

  # and our selection restoration will fail
  _setNewSelectionState: ->
    selection = document.getSelection()
    return if @_checkSameSelection(selection)
    return if not @_selectionInScope(selection)
    @_lastSelection =
      anchorNode: selection.anchorNode?.cloneNode(true)
      anchorOffset: selection.anchorOffset
      focusNode: selection.focusNode?.cloneNode(true)
      focusOffset: selection.focusOffset
    try
      range = selection.getRangeAt(0)
    catch


    @_refreshToolbarState()
    return @_selection

  # _setSelectionMarkers: (selection) ->
  #   startMarker = document.createElement("SPAN")
  #   startMarker.setAttribute "id", "nilas-start-marker"
  #   endMarker = document.createElement("SPAN")
  #   endMarker.setAttribute "id", "nilas-end-marker"
  #   selection.anchorNode.parentNode.insertBefore(startMarker, selection.anchorNode)
  #   selection.focusNode.parentNode.insertBefore(endMarker, selection.focusNode)

  _setSelectionSnapshot: (selection) -> @_selection = selection

