           editor.setText result
           @redraw()
           @hideViewPreview()
+          focusOnEditor()
         # Check if result is a Space-pen View (jQuery)
         else if result instanceof $
           # Is SpacePen View
           @renderViewForPreview(result)
+          focusOnEditor()
+
         else
           # Unknown result type
           @hideViewPreview() # Show Editor by default
+          focusOnEditor()
           return @showError new Error("Unsupported result type.")
 
       # Start preview processing

      # Create Callback
      callback = (error, result) =>
        @hideMessage()
        if error?
          return @showError error
        # Check if result is a string and therefore source code
        if typeof result is "string"


  changeHandler: () =>
    @debouncedRenderPreview()

  handleEvents: () ->
    currEditor = atom.workspace.getActiveEditor()
