       textInBetween = textAreaValue.substring(selectionStart, selectionEnd)
       textAfter = textAreaValue.substring(selectionEnd, textAreaValue.length)
       value = textBefore + startTag + textInBetween + endTag + textAfter
-    newAnnotation = Object.assign @props.annotation, {value}
-    @props.onChange newAnnotation
+    @setState { value }
 
   updateHeight: ->
     @setState textareaHeight: @refs.textInput.scrollHeight + 2

React = require 'react'
createReactClass = require 'create-react-class'
{Markdown} = require 'markdownz'
GenericTask = require('../generic.jsx').default
TextTaskEditor = require './editor'


  componentWillReceiveProps: (nextProps) ->
    if nextProps.task isnt @props.task
      @setState { value: '', textareaHeight: @state.initOffsetHeight }, =>
        @updateHeight()
    if nextProps.annotation.value isnt @props.annotation.value
      @setState value: nextProps.annotation.value

  componentDidUpdate: (prevProps) ->
    if prevProps.task isnt @props.task and @props.autoFocus is true
      @refs.textInput.focus()

  componentWillUnMount: ->
    @updateAnnotation()

  setTagSelection: (e) ->
    textTag = e.target.value
