     return iframe
 
   insertAt: (startIndex, text, attributes = {}) ->
+    @ignoreDomChanges = true
+    range = if _.isNumber(startIndex) then new Tandem.Range(this, startIndex, startIndex) else startIndex
     this.preserveSelection(range, text.length, ->
 
     )
+    @ignoreDomChanges = false
     # 1. Save selection
     # 2. Split text into lines
     # 3. Find node where it starts


  # applyAttribute: (TandemRange range, Object attribute) ->
  # applyAttribute: (Number startIndex, Number length, attribute) ->
  applyAttribute: (range, attribute) ->
    #if !_.isNumber(startIndex)
    #  selection = this.getSelection()
    #  startIndex = selection.getStartIndex()
    #  length = selection.getEndIndex() - startIndex

    this.preserveSelection(range, 0, =>
      range.splitEnds()
      _.each(range.groupNodesByLine(), (elems) =>

        )
      )
    )
    @ignoreDomChanges = false
    
  preserveSelection: (modificationRange, charAdditions, fn) ->
    currentSelection = this.getSelectionRange()
