 
   setDomContent = (content) ->
     if 'innerText' of $editorCode[0]
-      $editorCode[0].innerText = content
+      contentSrc = $editorCode[0].innerText = content
     else
       content = content.replace
-      $editorCode[0].innerHTML = he.encode content
+      contentSrc = $editorCode[0].innerHTML = he.encode content
 
   wantsToEdit = (evt) ->
     metaKey = evt.ctrlKey

      filename = filename.join '.'

    done = (body, status, xhr) ->
      currentContent = body
      if language?
        try
          high = hljs.highlight language, currentContent
        catch e
          high = {value: currentContent}
      else
        high = hljs.highlightAuto currentContent
        if high.language?
          history.replaceState undefined, undefined, "\##{filename}.#{high.language}"
          # window.location.hash = "#{filename}.#{high.language}"
          # return

      lock high.value

    fail = () ->


    fail = () ->
      $linenosCode.html "Failed to save".replace /(.)/g, '$1<br>'
      edit()

    lock null, 'Saving...'
    $.ajax({
      method
      url
      contentType: 'application/octet-stream'
      data: currentSrc
    }).always(always).done(done).fail(fail)
    false

  edit = (content = contentSrc) ->
    $content.html content
    $content.attr('contentEditable', 'true').focus()
    $content.on 'blur', keepFocus
    $body.addClass 'editing'
    $body.off 'keydown', disableSave
    $body.on 'keydown', maybeSave
    $body.on 'keydown', maybeCancelEditing

  lock = (content = contentSrc, lines = [], language) ->
    if Array.isArray lines
      if lines.length is 0
        linenosCount = content.split('\n').length
