   ###
   serialize: ->
     console.log 'serialize()'
+    previewPane = atom.workspace.paneForUri(@uri)
+    return {
+      isOpen: previewPane?
+    }
 
   ###
   # This optional method is called when the window is shutting down. If your

  ###
  deactivate: ->
    console.log 'deactivate()'

  toggle: ->
    editor = atom.workspace.getActiveEditor()
    return unless editor?
    uri = "preview://editor"
    previewPane = atom.workspace.paneForUri(uri)
    if previewPane
      previewPane.destroyItem(previewPane.itemForUri(uri))
      return
    previousActivePane = atom.workspace.getActivePane()
    atom.workspace.open(uri, split: 'right', searchAllPanes: true)
    .done (previewView) ->
      if previewView instanceof PreviewView
        previewView.renderHTML()

      # Create and show preview!
      new PreviewView()

    # Deserialize state
    @toggle if state.isOpen

  ###
  # This optional method is called when the window is shutting down, allowing
  # you to return JSON to represent the state of your component. When the
