Index: _source/plugins/justify/plugin.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- _source/plugins/justify/plugin.js	(revision 7397)
+++ _source/plugins/justify/plugin.js	(revision )
@@ -161,6 +161,7 @@
 			{
 				iterator = ranges[ i ].createIterator();
 				iterator.enlargeBr = enterMode != CKEDITOR.ENTER_BR;
+				iterator.enforceRealBlocks = 1;
 
 				while ( ( block = iterator.getNextParagraph( enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' ) ) )
 				{
Index: _source/plugins/list/plugin.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- _source/plugins/list/plugin.js	(revision 7403)
+++ _source/plugins/list/plugin.js	(revision )
@@ -102,6 +102,7 @@
 				indentLevel = Math.max( listArray[ baseIndex ].indent, 0 ),
 				currentListItem = null,
 				orgDir,
+				newBlock,
 				paragraphName = ( paragraphMode == CKEDITOR.ENTER_P ? 'p' : 'div' );
 			while ( 1 )
 			{
@@ -146,31 +147,38 @@
 					if ( listNodeNames[ item.grandparent.getName() ] )
 						currentListItem = item.element.clone( false, true );
 					else
+						currentListItem = new CKEDITOR.dom.documentFragment( doc );
+
+					// Migrate all children to the new container,
+					// apply the proper text direction.
+					var dirLoose = item.grandparent.getDirection( 1 ) != orgDir,
+						enterBr = paragraphMode == CKEDITOR.ENTER_BR;
+
+					for ( var i = 0, child, count = item.contents.length; i < count; i++ )
 					{
-						// Create completely new blocks here.
-						if ( dir || item.element.hasAttributes() || paragraphMode != CKEDITOR.ENTER_BR )
+						child = item.contents[ i ];
+						if ( child.type == CKEDITOR.NODE_ELEMENT && child.isBlockBoundary() )
 						{
-							currentListItem = doc.createElement( paragraphName );
-							item.element.copyAttributes( currentListItem, { type:1, value:1 } );
+							// Apply direction on content blocks.
+							if ( dirLoose && !child.getDirection() )
+								child.setAttribute( 'dir', orgDir );
 
-							// There might be a case where there are no attributes in the element after all
-							// (i.e. when "type" or "value" are the only attributes set). In this case, if enterMode = BR,
-							// the current item should be a fragment.
-							if ( !dir && paragraphMode == CKEDITOR.ENTER_BR && !currentListItem.hasAttributes() )
-								currentListItem = new CKEDITOR.dom.documentFragment( doc );
+							newBlock = null;
 						}
-						else
-							currentListItem = new CKEDITOR.dom.documentFragment( doc );
+						else if ( dirLoose || !enterBr )
+						{
+							// Wrap inline contents with new block, just to remain item direction.
+							if ( !newBlock )
+							{
+								newBlock = doc.createElement( paragraphName );
+								dirLoose && newBlock.setAttribute( 'dir', orgDir );
-					}
+							}
 
-					if ( currentListItem.type == CKEDITOR.NODE_ELEMENT )
-					{
-						if ( item.grandparent.getDirection( 1 ) != orgDir )
-							currentListItem.setAttribute( 'dir', orgDir );
+							newBlock.append( child.clone( 1, 1 ) );
-					}
+						}
 
-					for ( i = 0 ; i < item.contents.length ; i++ )
-						currentListItem.append( item.contents[i].clone( 1, 1 ) );
+						currentListItem.append( newBlock || child.clone( 1, 1 ) );
+					}
 
 					if ( currentListItem.type == CKEDITOR.NODE_DOCUMENT_FRAGMENT
 						 && currentIndex != listArray.length - 1 )
@@ -190,20 +198,6 @@
 						}
 					}
 
-					if ( currentListItem.type == CKEDITOR.NODE_ELEMENT &&
-							currentListItem.getName() == paragraphName &&
-							currentListItem.$.firstChild )
-					{
-						currentListItem.trim();
-						var firstChild = currentListItem.getFirst();
-						if ( firstChild.type == CKEDITOR.NODE_ELEMENT && firstChild.isBlockBoundary() )
-						{
-							var tmp = new CKEDITOR.dom.documentFragment( doc );
-							currentListItem.moveChildren( tmp );
-							currentListItem = tmp;
-						}
-					}
-
 					var currentListItemName = currentListItem.$.nodeName.toLowerCase();
 					if ( !CKEDITOR.env.ie && ( currentListItemName == 'div' || currentListItemName == 'p' ) )
 						currentListItem.appendBogus();
@@ -214,6 +208,9 @@
 				else
 					return null;
 
+				newBlock = null;
+
+
 				if ( listArray.length <= currentIndex || Math.max( listArray[ currentIndex ].indent, 0 ) < indentLevel )
 					break;
 			}
@@ -378,28 +375,40 @@
 
 		listsCreated.push( listNode );
 
-		var contentBlock, listItem;
+		var contentBlock, blockDir, listItem;
 
 		while ( listContents.length )
 		{
 			contentBlock = listContents.shift();
 			listItem = doc.createElement( 'li' );
 
-			// Preserve preformat block and heading structure when converting to list item. (#5335) (#5271)
-			if ( contentBlock.is( 'pre' ) || headerTagRegex.test( contentBlock.getName() ) )
+			// Take it off the tree to void bothering
+			// the direction change event.
+			contentBlock.remove();
+
+			if ( blockDir = contentBlock.getDirection() )
+			{
+				contentBlock.removeStyle( 'direction' );
+				contentBlock.removeAttribute( 'dir' );
+			}
+
+			// Preserve the block when converting to list item if:
+			// 1. In preformat; (#5335)
+			// 2. In heading structure; (#5271)
+			// 3. Styled or attributed. (#6461)
+			if ( contentBlock.is( 'pre' )
+				 || headerTagRegex.test( contentBlock.getName() )
+				 || contentBlock.hasAttributes() )
 				contentBlock.appendTo( listItem );
 			else
 			{
-				contentBlock.copyAttributes( listItem );
-				// Remove direction attribute after it was merged into list root. (#7657)
-				if ( listDir && contentBlock.getDirection() )
-				{
-					listItem.removeStyle( 'direction' );
-					listItem.removeAttribute( 'dir' );
-				}
 				contentBlock.moveChildren( listItem );
 				contentBlock.remove();
 			}
+
+			// Apply text direction on list item unless it's already applied on root. (#7657)
+			if ( blockDir && !listDir )
+				listItem.setAttribute( 'dir', blockDir );
 
 			listItem.appendTo( listNode );
 		}
