   # Snapshots
 
   createSnapshot: ->
-    text: @getText()
+    text: @getDocument()
     selectedRange: @getInternalSelectedRange()
 
-  restoreSnapshot: ({text, selectedRange}) ->
-    @text.replaceText(text)
+  restoreSnapshot: ({document, selectedRange}) ->
+    # TODO
+    @document.replaceDocument(document)
     @requestSelectedRange(selectedRange)
 
   # Document delegate


  # Private

  getText: ->
    @text.copy()

  getInternalSelectedRange: ->
    @selectionDelegate?.getSelectedRangeOfComposition?(this)


  replaceHTML: (html) ->
    @preserveSelectionEndPoint =>
      # TODO
      document = Trix.Document.fromHTML(html)
      @document.replaceDocument(document)

  insertFile: (file) ->
    if attachment = @attachments.create(file)
