     content: null
     markdown: null
 
+  onChangeTextarea: ->
+    editor = @refs.editor.getDOMNode()
+    @sendMarkdown(editor.value)
+    @contentUpdateFromMarkdown(editor.value)
+
   render: ->
     $ 'div', {key: 'root'}, [
       $ 'h1', {style: {textAlign: 'center', fontFamily: '"Poiret One", cursive', fontSize: '25px', height: '50px', lineHeight: '50px'}}, 'erlang editor'

        }, [
          $ 'textarea', {
            ref:'editor'
            onChange: @contentUpdateFromMarkdown
            style: {height: '100%', width: '100%', border: 0, outline: 0, fontSize: '14px', padding: '5px', overflow: 'auto', fontFamily:'Consolas, Menlo, monospace', resize: 'none', background: 'transparent'}
            value: @state.markdown
          }

$ = React.createElement

Editor = React.createClass
  contentUpdateFromMarkdown: (markdown)->
    @setState
      markdown: markdown
    try
      content = md2react markdown,
        gfm: true
        breaks: true
        tables: true
