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

    @attachmentLocationRange = null

  compositionDidRequestChangingSelectionToLocationRange: (locationRange) ->
    @requestedLocationRange = locationRange
    @documentWhenLocationRangeRequested = @composition.document
    @render() unless @handlingInput

  compositionDidLoadSnapshot: ->
    @compositionController.refreshViewCache()
    @render()
    @loadingSnapshot = false

  getSelectionManager: ->
    @selectionManager
