Index: /FCKeditor/trunk/editor/_source/classes/fckdomrange.js
===================================================================
--- /FCKeditor/trunk/editor/_source/classes/fckdomrange.js	(revision 121)
+++ /FCKeditor/trunk/editor/_source/classes/fckdomrange.js	(revision 122)
@@ -64,5 +64,5 @@
 	CheckIsCollapsed : function()
 	{
-		if ( this._Range )
+		if ( this._Range )	
 			return this._Range.collapsed ;
 	},
@@ -140,5 +140,5 @@
 	},
 
-	CheckEndOfBlock : function()
+	CheckEndOfBlock : function( refreshSelection )
 	{
 		// Create a clone of the current range.
@@ -154,4 +154,7 @@
 
 		oTestRange.Release() ;
+		
+		if ( refreshSelection ) 
+			this.Select() ;
 		
 		return bIsEndOfBlock ;
Index: /FCKeditor/trunk/editor/_source/classes/fckenterkey.js
===================================================================
--- /FCKeditor/trunk/editor/_source/classes/fckenterkey.js	(revision 121)
+++ /FCKeditor/trunk/editor/_source/classes/fckenterkey.js	(revision 122)
@@ -108,4 +108,8 @@
 	oRange.MoveToSelection() ;
 	
+	if ( !oRange.CheckIsCollapsed() )
+		return false ;
+
+	
 	var oStartBlock = oRange.StartBlock ;
 	var oEndBlock = oRange.EndBlock ;
@@ -242,22 +246,13 @@
 	var oRange = new FCKDomRange( this.Window ) ;
 	oRange.MoveToSelection() ;
-
-	// The selection boundaries must be in the same "block limit" element
-	if ( oRange.StartBlockLimit == oRange.EndBlockLimit && oRange.StartBlock && oRange.EndBlock )
-	{
-		if ( oRange.StartBlock != oRange.EndBlock )
-		{
-			this.DoEnter() ;
-			oRange.MoveToSelection() ;
-		}
-		
-		if ( oRange.CheckEndOfBlock() )
-		{
-			var oCurrentBlock = oRange.StartBlock ;
-			
-			var eNext = FCKDomTools.GetNextSourceElement( oCurrentBlock, true, [ oRange.StartBlockLimit.nodeName ], ['UL','OL'] ) ;
-			
-			bCustom = this._ExecuteBackspace( oRange, oCurrentBlock, eNext ) ;
-		}	
+	
+	// There is just one special case for collapsed selections at the end of a block.
+	if ( oRange.CheckIsCollapsed() && oRange.CheckEndOfBlock( FCKBrowserInfo.IsGecko ) )
+	{
+		var oCurrentBlock = oRange.StartBlock ;
+		
+		var eNext = FCKDomTools.GetNextSourceElement( oCurrentBlock, true, [ oRange.StartBlockLimit.nodeName ], ['UL','OL'] ) ;
+		
+		bCustom = this._ExecuteBackspace( oRange, oCurrentBlock, eNext ) ;
 	}
 
@@ -370,4 +365,13 @@
 					// Place the extracted contents in the duplicated block.
 					eDocFrag.AppendTo( eNewBlock ) ;
+
+					if ( FCKBrowserInfo.IsGecko )
+					{
+						// In Gecko, the last child node must be a bogus <br>. 
+						var eLastChild = FCKDomTools.GetLastChild( eNewBlock ) ;
+						
+						if ( !eLastChild || eLastChild.nodeName.toLowerCase() != 'br' || eLastChild.getAttribute( 'type', 2 ) != '_moz' )
+							eNewBlock.appendChild( FCKTools.CreateBogusBR( this.Window.document ) ) ;
+					}
 				}
 
Index: /FCKeditor/trunk/editor/_source/internals/fck.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fck.js	(revision 121)
+++ /FCKeditor/trunk/editor/_source/internals/fck.js	(revision 122)
@@ -108,5 +108,12 @@
 
 		var oDocument = this.EditorDocument ;
+		
+		if ( !oDocument )
+			return ;
+		
 		var oBody = oDocument.body ;
+		
+		if ( !oBody )
+			return ;
 		
 		FCKDomTools.TrimNode( oBody ) ;
@@ -171,4 +178,7 @@
 		var sXHTML ;
 		var oDoc = FCK.EditorDocument ;
+		
+		if ( !oDoc )
+			return null ;
 
 		if ( FCKConfig.FullPage )
@@ -513,4 +523,7 @@
 
 			sHtml = FCK.GetXHTML( FCKConfig.FormatSource ) ;
+			
+			if ( sHtml == null )
+				return false ;
 		}
 		else
@@ -526,4 +539,6 @@
 		// Update the toolbar (Running it directly causes IE to fail).
 		FCKTools.RunFunction( FCK.ToolbarSet.RefreshModeState, FCK.ToolbarSet ) ;
+		
+		return true ;
 	},
 
Index: /FCKeditor/trunk/editor/_source/internals/fckdomtools.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fckdomtools.js	(revision 121)
+++ /FCKeditor/trunk/editor/_source/internals/fckdomtools.js	(revision 122)
@@ -126,5 +126,5 @@
 		while( eChild )
 		{
-			if ( eChild.nodeType == 1 && eChild.tagName.Equals( childNames ) )
+			if ( eChild.nodeType == 1 && ( !childNames || eChild.tagName.Equals( childNames ) ) )
 				return eChild ;
 			
Index: /FCKeditor/trunk/editor/_source/internals/fckxhtml.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fckxhtml.js	(revision 121)
+++ /FCKeditor/trunk/editor/_source/internals/fckxhtml.js	(revision 122)
@@ -47,4 +47,6 @@
 	
 	// Remove the trailing <br> added by Gecko.
+	// REMOVE: Maybe the following is not anymore necessary because a similar
+	// check is made on _AppendNode
 	if ( FCKBrowserInfo.IsGecko )
 		sXHTML = sXHTML.replace( /<br\/>$/, '' ) ;
@@ -182,5 +184,6 @@
 				return false ;
 
-			if ( sNodeName == 'br' && htmlNode.getAttribute( 'type', 2 ) == '_moz' )
+			// Remove the <br> if it is a bogus node or is the last child.
+			if ( sNodeName == 'br' && ( htmlNode.getAttribute( 'type', 2 ) == '_moz' || !htmlNode.nextSibling ) )
 				return false ;
 
@@ -316,4 +319,8 @@
 	a : function( node, htmlNode )
 	{
+		// Firefox may create empty tags when deleting the selection in some special cases (SF-BUG 1556878).
+		if ( htmlNode.innerHTML.Trim().length == 0 && !node.getAttribute( 'name' ) )
+			return false ;
+
 		var sSavedUrl = htmlNode.getAttribute( '_fcksavedurl' ) ;
 		if ( sSavedUrl != null )
@@ -332,8 +339,4 @@
 
 		FCKXHtml._AppendChildNodes( node, htmlNode, false ) ;
-
-		// Firefox may create empty tags when deleting the selection in some special cases (SF-BUG 1556878).
-		if ( node.childNodes.length == 0 && !node.getAttribute( 'name' ) )
-			return false ;
 
 		return node ;
