       cssClass : "preview_switch"
 
     if @options.showHelperModal
-
-      @markdownLink = new KDCustomHTMLView
-        tagName     : 'a'
-        name        : "markdownLink"
-        value       : "markdown is enabled"
-        attributes  :
-          href      : '#'
-          value     : "markdown syntax is enabled"
-        cssClass    : 'markdown-link'
-        partial     : "What is Markdown?<span></span>"
-        tooltip     :
-          title     : "Show available Markdown formatting syntax"
-        click       : (event)=>
-          if $(event.target).is 'span'
-            link.hide()
-          else
-            markdownText = new KDMarkdownModalText
-            modal = new KDModalView
-              title       : "How to use the <em>Markdown</em> syntax."
-              cssClass    : "what-you-should-know-modal markdown-cheatsheet"
-              height      : "auto"
-              overlay     : yes
-              width       : 500
-              content     : markdownText.markdownText()
-              buttons     :
-                Close     :
-                  title   : 'Close'
-                  style   : 'modal-clean-gray'
-                  callback: -> modal.destroy()
-
+      @markdownLink = @getMarkdownLink()
       @previewOnOffContainer.addSubView @markdownLink
 
-    # if @options.openMaximized
-    #   log 'opening maximized'
-    #   @hide()
-    #   @textContainer = new KDView
-    #     cssClass:"modal-fullscreen-text"
-
-    #   @text = new KDInputViewWithPreview
-    #     type : "textarea"
-    #     cssClass : "fullscreen-data kdinput text"
-    #     allowMaximized : no
-    #     defaultValue : @getValue()
-
-    #   @textContainer.addSubView @text
-
-    #   modal = new KDModalView
-    #     title       : "Please enter your content here."
-    #     cssClass    : "modal-fullscreen"
-    #     width       : window.innerWidth-100
-    #     height      : window.innerHeight-100
-    #     # width       : $(window).width()-100
-    #     # height      : $(window).height()-100
-    #     view        : @textContainer
-    #     position:
-    #       top       : 35
-    #       left      : 35
-    #     overlay     : yes
-    #     buttons     :
-    #       Cancel    :
-    #         title   : "Discard changes"
-    #         style   : "modal-clean-gray"
-    #         callback:=>
-    #           modal.destroy()
-    #       Apply     :
-    #         title   : "Apply changes"
-    #         style   : "modal-clean-gray"
-    #         callback:=>
-    #           @setValue @text.getValue()
-    #           @generatePreview()
-    #           modal.destroy()
-
-
-    #   @utils.defer =>
-
-    #     modal.$(".kdmodal-content").height modal.$(".kdmodal-inner").height()-modal.$(".kdmodal-buttons").height()-modal.$(".kdmodal-title").height() # minus the margin, border pixels too..
-    #     modal.$(".fullscreen-data").height modal.$(".kdmodal-content").height()-30-23+10
-    #     modal.$(".input_preview").height   modal.$(".kdmodal-content").height()-0-21+10
-    #     modal.$(".input_preview").css maxHeight:  modal.$(".kdmodal-content").height()-0-21+10
-    #     modal.$(".input_preview div.preview_content").css maxHeight:  modal.$(".kdmodal-content").height()-0-21
-
-    #     contentWidth = modal.$(".kdmodal-content").width()-40
-    #     halfWidth  = contentWidth / 2
-
-    #     @text.on "PreviewHidden", =>
-    #       modal.$(".fullscreen-data").width contentWidth #-(modal.$("div.preview_switch").width()+20)-10
-    #       # modal.$(".input_preview").width (modal.$("div.preview_switch").width()+20)
-
-    #     @text.on "PreviewShown", =>
-    #       modal.$(".fullscreen-data").width contentWidth-halfWidth-5
-    #       # modal.$(".input_preview").width halfWidth-5
-
-    #     modal.$(".fullscreen-data").width contentWidth-halfWidth-5
-    #     modal.$(".input_preview").width halfWidth-5
-
     if @options.allowMaximized
-      @fullScreenBtn = new KDButtonView
-        style           : "clean-gray small"
-        cssClass        : "fullscreen-button"
-        title           : "Fullscreen Edit"
-        icon            : no
-        tooltip         :
-          title         : "Open a Fullscreen Editor"
-        callback: =>
-          @textContainer = new KDView
-            cssClass:"modal-fullscreen-text"
-
-          @text = new KDInputViewWithPreview
-            type : "textarea"
-            cssClass : "fullscreen-data kdinput text"
-            allowMaximized : no
-            defaultValue : @getValue()
-
-          @textContainer.addSubView @text
-
-          @modal = new KDModalView
-            title       : "Please enter your content here."
-            cssClass    : "modal-fullscreen"
-            width       : window.innerWidth-100
-            height      : window.innerHeight-100
-            # width       : $(window).width()-100
-            # height      : $(window).height()-100
-            view        : @textContainer
-            position:
-              top       : 35
-              left      : 35
-            overlay     : yes
-            buttons     :
-              Apply     :
-                title   : "Apply changes"
-                style   : "modal-clean-gray"
-                callback:=>
-                  @setValue @text.getValue()
-                  @generatePreview()
-                  @modal.destroy()
-              Cancel    :
-                title   : "cancel"
-                style   : "modal-cancel"
-                callback:=> @modal.destroy()
-
-          @utils.defer =>
-            @setPaneSizes()
-
-          $(window).on "resize", =>
-            # (do/dont) Set width as "half" if preview is on
-            willSetWidths = @previewOnOffSwitch.defaultValue is on
-            @setPaneSizes(willSetWidths)
-
-      # @addSubView @fullScreenBtn
-      @previewOnOffContainer.addSubView @fullScreenBtn
+      @fullscreenEditButton = @getFullscreenEditButton()
+      @previewOnOffContainer.addSubView @fullscreenEditButton
 
     @previewOnOffContainer.addSubView @previewOnOffLabel
     @previewOnOffContainer.addSubView @previewOnOffSwitch
 
     @addSubView @previewOnOffContainer
 
-  setPaneSizes:(willSetWidths = yes)->
-    # selector performance ?
+    @listenWindowResize()
+
+  setPaneSizes:(opt_setWidths = yes)->
+    # For: "Uncaught TypeError: Cannot call method '$' of undefined"
+    return  unless @modal
+
+    # selector performance?
+    kdmodalContent = @modal.$(".kdmodal-content")
     fullscreenData = @modal.$(".fullscreen-data")
     inputPreview   = @modal.$(".input_preview")
-    kdmodalContent = @modal.$(".kdmodal-content")
 
     # minus the margin, border pixels too..
     kdmodalContent.height @modal.$(".kdmodal-inner").height() - @modal.$(".kdmodal-buttons").height() - @modal.$(".kdmodal-title").height()

class KDInputViewWithPreview extends KDInputView

  constructor:(options={},data)->

    options.preview               ?= {}
    options.preview.autoUpdate    ?= yes
    options.preview.language      or= "markdown"
    options.preview.showInitially ?= yes

  setPreviewScrollPercentage:(percentage)->
    s = @$("div.preview_content")
    s.animate
     scrollTop : ((s[0].scrollHeight - s.height()) * percentage / 100)
    , 50, "linear"

  setDomElement:(cssClass="")->
