       Math.floor(new Date().getTime() / Trix.config.undoInterval)
     else
       0
+
+  isFocused: ->
+    @editorElement is @editorElement.ownerDocument?.activeElement

  compositionDidLoadSnapshot: ->
    @compositionController.refreshViewCache()
    @render()

  getSelectionManager: ->
    @selectionManager

    @loadSnapshot({document, selectedRange: [0, 0]})

  loadSnapshot: (snapshot) ->
    @loadingSnapshot = true
    @undoManager = new Trix.UndoManager @composition
    @composition.loadSnapshot(snapshot)

