     $linenosCode.html "Esc - #{metaKeyName}+s - Shift+#{metaKeyName}+s".replace /(.)/g, '$1<br>'
     $editorCode.html(content).attr('contentEditable', 'true').focus()
     $editor.addClass('editing')
-    $window.off 'keydown', disableSave
-    $window.on 'keydown', maybeSave
+    $body.off 'keydown', disableSave
+    $body.on 'keydown', maybeSave
 
   lock = (content, lines = []) ->
     content ?= getDomContent()

  startEditing = (evt) ->
    evt.preventDefault()
    edit currentContent
    $window.off 'dblclick', startEditing
    window.getSelection()?.removeAllRanges()
    false

  maybeCancelEditing = (evt) ->

$ () ->
  currentContent = ''
  $window = $ window
  $body = $ window.document.body
  $style = $ '#style'
  $selectedStyle = $ '#selectedStyle'
  $linenos = $ '#linenos'
