Index: /FCKeditor/trunk/editor/_source/internals/fck.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fck.js	(revision 82)
+++ /FCKeditor/trunk/editor/_source/internals/fck.js	(revision 83)
@@ -97,4 +97,67 @@
 		this.Events.FireEvent( 'OnStatusChange', newStatus ) ;
 	},
+	
+	// Fixes the body by moving all inline and text nodes to appropriate block
+	// elements.
+	FixBody : function()
+	{
+		var sBlockTag = FCKConfig.EnterMode ;
+		
+		// In 'br' mode, no fix must be done.
+		if ( sBlockTag != 'p' && sBlockTag != 'div' )
+			return ;
+
+		var oDocument = this.EditorDocument ;
+		var oBody = oDocument.body ;
+		
+		FCKDomTools.TrimNode( oBody ) ;
+		
+		var oNode = oBody.firstChild ;
+		var oNewBlock ;
+		
+		while ( oNode )
+		{
+			var bMoveNode = false ;
+
+			switch ( oNode.nodeType )
+			{
+				// Element Node.
+				case 1 :
+					if ( !FCKListsLib.BlockElements[ oNode.nodeName.toLowerCase() ] )
+						bMoveNode = true ;
+					break ;
+
+				// Text Node.
+				case 3 :
+					// Ignore space only or empty text.
+					if ( oNewBlock || oNode.nodeValue.Trim().length > 0 )
+						bMoveNode = true ;
+			}
+			
+			if ( bMoveNode )
+			{
+				var oParent = oNode.parentNode ;
+
+				if ( !oNewBlock )
+					oNewBlock = oParent.insertBefore( oDocument.createElement( sBlockTag ), oNode ) ;
+				
+				oNewBlock.appendChild( oParent.removeChild( oNode ) ) ;
+				
+				oNode = oNewBlock.nextSibling ;
+			}
+			else 
+			{
+				if ( oNewBlock )
+				{
+					FCKDomTools.TrimNode( oNewBlock ) ;
+					oNewBlock == null ;
+				}
+				oNode = oNode.nextSibling ;
+			}
+		}
+
+		if ( oNewBlock )
+			FCKDomTools.TrimNode( oNewBlock ) ;
+	},
 
 	GetXHTML : function( format )
@@ -104,4 +167,6 @@
 		if ( FCK.EditMode == FCK_EDITMODE_SOURCE )
 				return FCK.EditingArea.Textarea.value ;
+
+		this.FixBody() ;
 
 		var sXHTML ;
Index: /FCKeditor/trunk/editor/_source/internals/fckregexlib.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fckregexlib.js	(revision 82)
+++ /FCKeditor/trunk/editor/_source/internals/fckregexlib.js	(revision 83)
@@ -76,2 +76,11 @@
 ProtectedEvents : /\s\w+_fckprotectedatt="([^"]+)"/g
 } ;
+
+// Test have shown that check for the existence of a key in an object is the
+// most efficient list entry check (10x faster that regex). Example:
+//		if ( FCKListsLib.<ListName>[key] != null )
+var FCKListsLib =
+{
+	// We are not handling <ins> and <del> as block elements, for now.
+	BlockElements : { address:1,blockquote:1,div:1,dl:1,fieldset:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,noscript:1,ol:1,p:1,pre:1,script:1,table:1,ul:1 }
+} ;
