Index: /CKEditor/branches/prototype/_source/plugins/link/dialogs/link.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/link/dialogs/link.js	(revision 2876)
+++ /CKEditor/branches/prototype/_source/plugins/link/dialogs/link.js	(revision 2877)
@@ -80,8 +80,15 @@
 		loadLink = function( editor, selection, ranges, element )
 	{
-		var href = element.getAttribute( '_cke_saved_href' ) || element.getAttribute( 'href' ),
-			emailMatch = href.match( emailRegex ),
-			anchorMatch = href.match( anchorRegex ),
-			me = this;
+		var href = element.getAttribute( '_cke_saved_href' ) || element.getAttribute( 'href' );
+		var emailMatch = '';
+		var anchorMatch = '';
+		var urlMatch = false;
+		if ( href != null )
+		{
+			emailMatch = href.match( emailRegex );
+			anchorMatch = href.match( anchorRegex );
+			urlMatch = href.match( urlRegex );
+		}
+		var me = this;
 
 		// Load the link type and URL.
@@ -101,5 +108,5 @@
 			this.setValueOf( 'info', 'anchorId', anchorMatch[1] );
 		}
-		else
+		else if ( urlMatch )
 		{
 			var urlMatch = href.match( urlRegex );
@@ -108,4 +115,10 @@
 			this.setValueOf( 'info', 'url', urlMatch[2] );
 		}
+		else
+		{
+			this.setValueOf( 'info', 'linkType', editor.config.pluginConfig.link.defaultValues.linkType );
+			this.setValueOf( 'info', 'protocol', editor.config.pluginConfig.link.defaultValues.protocol );
+			this.setValueOf( 'info', 'url', '' );
+		} 
 
 		// Load target and popup settings.
@@ -230,4 +243,7 @@
 												return true;
 
+											if ( this.getDialog().fakeObj != false )	// Edit Anchor.
+												return true;
+
 											var func = CKEDITOR.dialog.validate.notEmpty( editor.lang.link.noUrl );
 											return func.apply( this );
@@ -636,4 +652,5 @@
 		onShow : function()
 		{
+			this.fakeObj = false;
 			// IE BUG: Selection must be in the editor for getSelection() to work.
 			this.restoreSelection();
@@ -696,4 +713,14 @@
 					loadLink.apply( this, [ editor, selection, ranges, element ] );
 					selection.selectElement( element );
+					this.saveSelection();
+				}
+
+				element = rangeRoot.getAscendant( 'img', true );
+				if ( element && element.getAttribute( '_cke_real_element_type' ) && element.getAttribute( '_cke_real_element_type' ) == 'anchor' )
+				{
+					this.fakeObj = element;
+					element = CKEDITOR.plugins.fakeobjects.restoreElement( this.fakeObj );
+					loadLink.apply( this, [ editor, selection, ranges, element ] );
+					selection.selectElement( this.fakeObj );
 					this.saveSelection();
 				}
@@ -829,4 +856,7 @@
 				// We're only editing an existing link, so just overwrite the attributes.
 				this._.selectedElement.setAttributes( attributes );
+				if ( this.fakeObj )
+					CKEDITOR.plugins.fakeobjects.updateFakeElement( this.fakeObj, this._.selectedElement );
+
 				delete this._.selectedElement;
 			}
