 
     @setEditorTheme()
     @setEditorMode 'html'
+
+    callback?()
 
   handleSave: ->
     @save()

  setValue: (value) ->
    @codeMirrorEditor.setValue value

  createEditor: ->
    @codeMirrorEditor = CodeMirror @container.getDomElement()[0],
      lineNumbers     : yes
      scrollPastEnd   : yes

    super options, data

    @container.on "viewAppended", =>
      @createEditor =>
        @ref        = @workspace.firebaseRef.child @sessionKey
        @firepad    = Firepad.fromCodeMirror @ref, @codeMirrorEditor

        @firepad.on "ready", =>
          if @firepad.isHistoryEmpty() # fix for a firepad bug
            @firepad.setText " "
            @firepad.setText ""
          @codeMirrorEditor.scrollTo 0, 0
          {file, content} = @getOptions()
          return @openFile file, content  if file

        if @amIHost
          @ref.on "value", (snapshot) =>
            value = @workspace.reviveSnapshot snapshot
            return unless value
            if value.WaitingSaveRequest is yes
              return @save()

  openFile: (file, content) ->
    @setData file
