 
     @confirm.on 'click', (e) =>
       return if e.which == 13
-      return @urlEl.trigger('focus') if @confirm.hasClass('disabled')
-
-      val = @urlEl.val()
-
-      val = 'http://' + val unless /https?:\/\/|^\//ig.test(val) or !val
-      @confirm[if val then 'removeClass' else 'addClass']('disabled')
-
-      @target.attr 'href', val
+      if @confirm.hasClass('disabled')
+        if @textEl.val()
+          @urlEl.trigger('focus')
+        else
+          @textEl.trigger('focus')
+        return
+      @checkButtonStatus()
+      @target.attr 'href', @urlEl.val()
       @editor.inputManager.throttledValueChanged()
       @active = true
       @hide()

    else
      $contents = $(range.extractContents())
      linkText = @editor.formatter.clearHtml($contents.contents(), false)
      $link = $('<a/>', {
        href: '',
        target: '_blank',
        text: linkText || @_t('linkText')
      })

      if @editor.selection.blockNodes().length > 0
        range.insertNode $link[0]
      else
        $newBlock = $('<p/>').append($link)
        range.insertNode $newBlock[0]

      range.selectNodeContents $link[0]

      @popover.one 'popovershow', =>
        if linkText

    @close.on 'click', (e) =>
      text = if @val then @textEl.val() else ''
      @target.text text
      @editor.inputManager.throttledValueChanged()
      unless text and @urlEl.val()
        @button.node.remove()
      @active = true
      @hide()

  checkButtonStatus: (val1, val2)->
    val1 or= @textEl.val()
    val2 or= @urlEl.val()
    val2 = 'http://' + val2 unless /https?:\/\/|^\//ig.test(val2) or !val2

    @confirm[if val1 and val2 then 'removeClass' else 'addClass']('disabled')

  show: (args...) ->
    super args...
    val1 = @target.text()
    @textEl.val val1
    @val = @target.attr('href')
    @urlEl.val @val
    @checkButtonStatus(val1, @val)

    @active = false

