 fs = require "fs-plus"
 
 ### TODO
-- Able to remove existing link
 - Support link with id
 ###
 


  onConfirm: ->
    text = @textEditor.getText()
    title = @titleEditor.getText()
    url = @urlEditor.getText()
    @insertLinkToEditor(text, title, url)
    @saveLink(text, title, url) if @saveCheckbox.prop("checked")
    @detach()

  display: ->

    atom.workspaceView.append(this)
    @searchBox.hide()
    if @textEditor.getText()
      @urlEditor.getEditor().selectAll()
      @urlEditor.focus()
    else
      @textEditor.focus()
