 Spine       = require('spine/core')
 $           = Spine.$
 Showdown    = require('showdown')
+{_}         = require("underscore")
 
 
 class PreviewUI extends Spine.Controller

  close: (e) =>
    e?.preventDefault()
    @parentForm.removeClass('preview-mode')
    @release()



    @inner.html contentHtml
  
  setupLivePreview: =>
    # Wait before firing the event constantly (a way to throttle)
    @lazyRender = _.debounce(@render, 800)
    @field.on 'keyup', @lazyRender

  setupCloseButton: ->
    @el.append $('<a class="close-button button small">X</a>')
