-dirty = false
+diskOutdated = false
+renderOutdated = true
 
 converter = new Markdown.Converter()
 markdown = (s) -> converter.makeHtml(s)
 
-code = ''
+code = '# Headline\n\nThis is some plain text.\n\n    print("Hello World");'
 textarea = undefined
 outputarea = undefined
 showHideCodeButton = undefined

showCodeText = 'Show code'

window.addEventListener('beforeunload', (e) ->
  if dirty
    e.returnValue = 'Are you sure you want to leave this page?'
)

window.App =
  init: ->
    textarea = CodeMirror $('#source .panel-body').get(0),
      value: '# Headline\n\nThis is some plain
      text.\n\n    print("Hello World");'
      mode: 'markdown'
      indentUnit: 4


    if reader.result == undefined
      console.log('file contents are undefined')
      return

    # Populate the text field with the new source code
    code = reader.result
    textarea.setValue(reader.result)
    diskOutdated = false
    renderOutdated = true

  reader.readAsText(file)

save = ->
