code: function( popup, modify_a_href )
          {
              var textbox = document.createElement('input');
              textbox.placeholder = 'www.example.com';
              if( modify_a_href )
                  textbox.value = modify_a_href.href;
              textbox.style.width = '20em';
              textbox.style.maxWidth = parseInt(node_container.offsetWidth *2/3) + 'px';
              textbox.autofocus = true;
              if( modify_a_href )
                  addEvent( textbox, 'input', function( e )
                  {
                      var url = textbox.value.trim();
                      if( url )
                          modify_a_href.href = url;
                  });
              addEvent( textbox, 'keypress', function( e )
              {
                  var key = e.which || e.keyCode;
                  if( key != 13 )
                      return;
                  var url = textbox.value.trim();
                  if( modify_a_href )
                      ;
                  else if( url )
                  {
                      var url_scheme = url;
                      if( ! /^[a-z0-9]+:\/\//.test(url) )
                          url_scheme = "http://" + url;
                      if( commands.getSelectedHTML() )
                          commands.insertLink( url_scheme );
                      else
                      {
                          // Encode html entities - http://stackoverflow.com/questions/5499078/fastest-method-to-escape-html-tags-as-html-entities
                          var htmlencode = function( text ) {
                              return text.replace(/[&<>"]/g, function(tag)
                              {
                                  var charsToReplace = { '&':'&amp;', '<':'&lt;', '>':'&gt;', '"':'&quot;' };
                                  return charsToReplace[tag] || tag;
                              });
                          }
                          commands.insertHTML( '<a href="' + htmlencode(url_scheme) + '">' + htmlencode(url) + '</a>' );
                      }
                  }
                  commands.closePopup().collapseSelection();
                  node_contenteditable.focus();
              });
              popup.appendChild( textbox );
              // set focus
              window.setTimeout( function()
              {
                  textbox.focus();
                  add_class_focus();
              }, 1 );
          }
docs: Insert-link popup