     @domPollingIntervalId = null
 
   componentDidUpdate: ->
+    @updateSync()
+
+  updateSync: ->
+    @oldState ?= {}
+    @newState = @presenter.state
+
     cursorMoved = @cursorMoved
     selectionChanged = @selectionChanged
     @cursorMoved = false
     @selectionChanged = false
+
+    node = @getDOMNode()
+    {editor} = @props
+
+    if editor.getLastSelection()? and !editor.getLastSelection().isEmpty()
+      node.classList.add('has-selection')
+    else
+      node.classList.remove('has-selection')
+
+    if @newState.focused isnt @oldState.focused
+      node.classList.toggle('is-focused', @newState.focused)
+
+    @performedInitialMeasurement = false if editor.isDestroyed()
+
+    if @performedInitialMeasurement
+      if @newState.height isnt @oldState.height
+        if @newState.height?
+          node.style.height = @newState.height + 'px'
+        else
+          node.style.height = ''
 
     if @presenter.state.gutter.visible
       @mountGutterComponent() unless @gutterComponent?


    @domPollingIntervalId = setInterval(@pollDOM, @domPollingInterval)

    @updateParentViewFocusedClassIfNeeded()
    @updateParentViewMiniClass()
    @checkForVisibilityChange()

  componentWillUnmount: ->

  gutterComponent: null

  render: ->
    if @props.useShadowDOM
      className = 'editor-contents--private'
    else
      className = 'editor-contents'

    div {className},
      div ref: 'scrollView', className: 'scroll-view'

  getInitialState: -> {}
