   # 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)

class Trix.Composition
  constructor: (@document = new Trix.Document, config) ->
    @document.delegate = this
    @currentAttributes = {}

    @attachments = new Trix.AttachmentManager this
