Index: /CKEditor/branches/versions/3.6.x/_source/core/dom/walker.js
===================================================================
--- /CKEditor/branches/versions/3.6.x/_source/core/dom/walker.js	(revision 6779)
+++ /CKEditor/branches/versions/3.6.x/_source/core/dom/walker.js	(revision 6780)
@@ -339,5 +339,7 @@
 	CKEDITOR.dom.element.prototype.isBlockBoundary = function( customNodeNames )
 	{
-		var nodeNameMatches = CKEDITOR.tools.extend( {}, CKEDITOR.dtd.$block, customNodeNames || {} );
+		var nodeNameMatches = customNodeNames ?
+			CKEDITOR.tools.extend( {}, CKEDITOR.dtd.$block, customNodeNames || {} ) :
+			CKEDITOR.dtd.$block;
 
 		// Don't consider floated formatting as block boundary, fall back to dtd check in that case. (#6297)
Index: /CKEditor/branches/versions/3.6.x/_source/core/dtd.js
===================================================================
--- /CKEditor/branches/versions/3.6.x/_source/core/dtd.js	(revision 6779)
+++ /CKEditor/branches/versions/3.6.x/_source/core/dtd.js	(revision 6780)
@@ -182,5 +182,4 @@
         table : {thead:1,col:1,tbody:1,tr:1,colgroup:1,caption:1,tfoot:1},
         code : L,
-        script : N,
         tfoot : M,
         cite : L,
Index: /CKEditor/branches/versions/3.6.x/_source/core/editor.js
===================================================================
--- /CKEditor/branches/versions/3.6.x/_source/core/editor.js	(revision 6779)
+++ /CKEditor/branches/versions/3.6.x/_source/core/editor.js	(revision 6780)
@@ -576,5 +576,5 @@
 		 *		executed, otherwise "false".
 		 * @example
-		 * editorInstance.execCommand( 'Bold' );
+		 * editorInstance.execCommand( 'bold' );
 		 */
 		execCommand : function( commandName, data )
Index: /CKEditor/branches/versions/3.6.x/_source/core/htmlparser.js
===================================================================
--- /CKEditor/branches/versions/3.6.x/_source/core/htmlparser.js	(revision 6779)
+++ /CKEditor/branches/versions/3.6.x/_source/core/htmlparser.js	(revision 6780)
@@ -19,5 +19,5 @@
 	this._ =
 	{
-		htmlPartsRegex : new RegExp( '<(?:(?:\\/([^>]+)>)|(?:!--([\\S|\\s]*?)-->)|(?:([^\\s>]+)\\s*((?:(?:[^"\'>]+)|(?:"[^"]*")|(?:\'[^\']*\'))*)\\/?>))', 'g' )
+		htmlPartsRegex : new RegExp( '<(?:(?:\\/([^>]+)>)|(?:!--([\\S|\\s]*?)-->)|(?:([^\\s>]+)\\s*((?:(?:"[^"]*")|(?:\'[^\']*\')|[^"\'>])*)\\/?>))', 'g' )
 	};
 };
Index: /CKEditor/branches/versions/3.6.x/_source/core/htmlparser/fragment.js
===================================================================
--- /CKEditor/branches/versions/3.6.x/_source/core/htmlparser/fragment.js	(revision 6779)
+++ /CKEditor/branches/versions/3.6.x/_source/core/htmlparser/fragment.js	(revision 6780)
@@ -361,6 +361,6 @@
 		parser.onText = function( text )
 		{
-			// Trim empty spaces at beginning of element contents except <pre>.
-			if ( !currentNode._.hasInlineStarted && !inPre )
+			// Trim empty spaces at beginning of text contents except <pre>.
+			if ( ( !currentNode._.hasInlineStarted || pendingBRs.length ) && !inPre )
 			{
 				text = CKEDITOR.tools.ltrim( text );
Index: /CKEditor/branches/versions/3.6.x/_source/plugins/clipboard/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.6.x/_source/plugins/clipboard/plugin.js	(revision 6779)
+++ /CKEditor/branches/versions/3.6.x/_source/plugins/clipboard/plugin.js	(revision 6780)
@@ -215,15 +215,5 @@
 		// Turn off design mode temporarily before give focus to the paste bin.
 		if ( mode == 'text' )
-		{
-			if ( CKEDITOR.env.ie )
-			{
-				var ieRange = doc.getBody().$.createTextRange();
-				ieRange.moveToElementText( pastebin.$ );
-				ieRange.execCommand( 'Paste' );
-				evt.data.preventDefault();
-			}
-			else
-				pastebin.$.focus();
-		}
+			pastebin.$.focus();
 		else
 		{
@@ -380,6 +370,4 @@
 				editor.on( 'key', onKey, editor );
 
-				var mode = editor.config.forcePasteAsPlainText ? 'text' : 'html';
-
 				// We'll be catching all pasted content in one line, regardless of whether the
 				// it's introduced by a document command execution (e.g. toolbar buttons) or
@@ -388,11 +376,15 @@
 				{
 					var body = editor.document.getBody();
-					body.on( ( ( mode == 'text' && CKEDITOR.env.ie ) || CKEDITOR.env.webkit ) ? 'paste' : 'beforepaste',
-						function( evt )
+					body.on( 'beforepaste', function( evt )
 						{
 							if ( depressBeforeEvent )
 								return;
 
-							getClipboardData.call( editor, evt, mode, function ( data )
+							// Fire 'beforePaste' event so clipboard flavor get customized
+							// by other plugins.
+							var eventData =  { mode : 'html' };
+							editor.fire( 'beforePaste', eventData );
+
+							getClipboardData.call( editor, evt, eventData.mode, function ( data )
 							{
 								// The very last guard to make sure the
@@ -402,5 +394,5 @@
 
 								var dataTransfer = {};
-								dataTransfer[ mode ] = data;
+								dataTransfer[ eventData.mode ] = data;
 								editor.fire( 'paste', dataTransfer );
 							} );
Index: /CKEditor/branches/versions/3.6.x/_source/plugins/colordialog/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.6.x/_source/plugins/colordialog/plugin.js	(revision 6779)
+++ /CKEditor/branches/versions/3.6.x/_source/plugins/colordialog/plugin.js	(revision 6780)
@@ -1,13 +1,15 @@
-﻿( function()
+﻿/*
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
+For licensing, see LICENSE.html or http://ckeditor.com/license
+*/
+
+CKEDITOR.plugins.colordialog =
 {
-	CKEDITOR.plugins.colordialog =
+	init : function( editor )
 	{
-		init : function( editor )
-		{
-			editor.addCommand( 'colordialog', new CKEDITOR.dialogCommand( 'colordialog' ) );
-			CKEDITOR.dialog.add( 'colordialog', this.path + 'dialogs/colordialog.js' );
-		}
-	};
+		editor.addCommand( 'colordialog', new CKEDITOR.dialogCommand( 'colordialog' ) );
+		CKEDITOR.dialog.add( 'colordialog', this.path + 'dialogs/colordialog.js' );
+	}
+};
 
-	CKEDITOR.plugins.add( 'colordialog', CKEDITOR.plugins.colordialog );
-} )();
+CKEDITOR.plugins.add( 'colordialog', CKEDITOR.plugins.colordialog );
Index: /CKEditor/branches/versions/3.6.x/_source/plugins/dialog/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.6.x/_source/plugins/dialog/plugin.js	(revision 6779)
+++ /CKEditor/branches/versions/3.6.x/_source/plugins/dialog/plugin.js	(revision 6780)
@@ -1906,4 +1906,9 @@
 		currentCover;
 
+	function cancelEvent( ev )
+	{
+		ev.data.preventDefault(1);
+	}
+
 	function showCover( editor )
 	{
@@ -1965,4 +1970,8 @@
 			coverElement = CKEDITOR.dom.element.createFromHtml( html.join( '' ) );
 			coverElement.setOpacity( backgroundCoverOpacity != undefined ? backgroundCoverOpacity : 0.5 );
+
+			coverElement.on( 'keydown', cancelEvent );
+			coverElement.on( 'keypress', cancelEvent );
+			coverElement.on( 'keyup', cancelEvent );
 
 			coverElement.appendTo( CKEDITOR.document.getBody() );
Index: /CKEditor/branches/versions/3.6.x/_source/plugins/pastefromword/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.6.x/_source/plugins/pastefromword/plugin.js	(revision 6779)
+++ /CKEditor/branches/versions/3.6.x/_source/plugins/pastefromword/plugin.js	(revision 6780)
@@ -5,4 +5,6 @@
 (function()
 {
+	function forceHtmlMode( evt ) { evt.data.mode = 'html'; }
+
 	CKEDITOR.plugins.add( 'pastefromword',
 	{
@@ -16,4 +18,5 @@
 				{
 					evt && evt.removeListener();
+					editor.removeListener( 'beforePaste', forceHtmlMode );
 					forceFromWord && setTimeout( function() { forceFromWord = 0; }, 0 );
 				};
@@ -28,6 +31,9 @@
 				exec : function()
 				{
+					// Ensure the received data format is HTML and apply content filtering. (#6718)
 					forceFromWord = 1;
-					if ( editor.execCommand( 'paste' ) === false )
+					editor.on( 'beforePaste', forceHtmlMode );
+
+					if ( editor.execCommand( 'paste', 'html' ) === false )
 					{
 						editor.on( 'dialogShow', function ( evt )
Index: /CKEditor/branches/versions/3.6.x/_source/plugins/pastetext/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.6.x/_source/plugins/pastetext/plugin.js	(revision 6779)
+++ /CKEditor/branches/versions/3.6.x/_source/plugins/pastetext/plugin.js	(revision 6780)
@@ -59,5 +59,7 @@
 				editor.on( 'beforeCommandExec', function ( evt )
 				{
-					if ( evt.data.name == 'paste' )
+					var mode = evt.data.commandData;
+					// Do NOT overwrite if HTML format is explicitly requested.
+					if ( evt.data.name == 'paste' && mode != 'html' )
 					{
 						editor.execCommand( 'pastetext' );
@@ -65,4 +67,9 @@
 					}
 				}, null, null, 0 );
+
+				editor.on( 'beforePaste', function( evt )
+				{
+					evt.data.mode = 'text';
+				});
 			}
 
@@ -83,4 +90,5 @@
  * editor, loosing any formatting information possibly available in the source
  * text.
+ * <strong>Note:</strong> paste from word is not affected by this configuration.
  * @name CKEDITOR.config.forcePasteAsPlainText
  * @type Boolean
Index: /CKEditor/branches/versions/3.6.x/_source/plugins/selection/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.6.x/_source/plugins/selection/plugin.js	(revision 6779)
+++ /CKEditor/branches/versions/3.6.x/_source/plugins/selection/plugin.js	(revision 6780)
@@ -569,8 +569,8 @@
 
 	var styleObjectElements =
-	{
-		img:1,hr:1,li:1,table:1,tr:1,td:1,th:1,embed:1,object:1,ol:1,ul:1,
-		a:1, input:1, form:1, select:1, textarea:1, button:1, fieldset:1, th:1, thead:1, tfoot:1
-	};
+		{
+			img:1,hr:1,li:1,table:1,tr:1,td:1,th:1,embed:1,object:1,ol:1,ul:1,
+			a:1,input:1,form:1,select:1,textarea:1,button:1,fieldset:1,thead:1,tfoot:1
+		};
 
 	CKEDITOR.dom.selection.prototype =
Index: /CKEditor/branches/versions/3.6.x/_source/plugins/wysiwygarea/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.6.x/_source/plugins/wysiwygarea/plugin.js	(revision 6779)
+++ /CKEditor/branches/versions/3.6.x/_source/plugins/wysiwygarea/plugin.js	(revision 6780)
@@ -11,17 +11,13 @@
 (function()
 {
-	// List of elements in which has no way to move editing focus outside.
-	var nonExitableElementNames = { table:1,pre:1 };
-
 	// Matching an empty paragraph at the end of document.
-	var emptyParagraphRegexp = /(^|<body\b[^>]*>)\s*<(p|div|address|h\d|center)[^>]*>\s*(?:<br[^>]*>|&nbsp;|\u00A0|&#160;)?\s*(:?<\/\2>)?\s*(?=$|<\/body>)/gi;
+	var emptyParagraphRegexp = /(^|<body\b[^>]*>)\s*<(p|div|address|h\d|center|pre)[^>]*>\s*(?:<br[^>]*>|&nbsp;|\u00A0|&#160;)?\s*(:?<\/\2>)?\s*(?=$|<\/body>)/gi;
 
 	var notWhitespaceEval = CKEDITOR.dom.walker.whitespaces( true );
 
-	// Elements that could have empty new line around, including table, pre-formatted block, hr, page-break. (#6554)
-	function nonExitable( element )
+	// Elements that could blink the cursor anchoring beside it, like hr, page-break. (#6554)
+	function nonEditable( element )
 	{
-		return ( element.getName() in nonExitableElementNames )
-				|| element.isBlockBoundary() && CKEDITOR.dtd.$empty[ element.getName() ];
+		return element.isBlockBoundary() && CKEDITOR.dtd.$empty[ element.getName() ];
 	}
 
@@ -411,5 +407,5 @@
 				if ( element &&
 					 element.type == CKEDITOR.NODE_ELEMENT &&
-					 !nonExitable( element ) )
+					 !nonEditable( element ) )
 				{
 					range.moveToElementEditStart( element );
@@ -421,5 +417,5 @@
 					if ( element &&
 						 element.type == CKEDITOR.NODE_ELEMENT &&
-						 !nonExitable( element ) )
+						 !nonEditable( element ) )
 					{
 						range.moveToElementEditEnd( element );
@@ -434,20 +430,11 @@
 		}
 
-		// All browsers are incapable to moving cursor out of certain non-exitable
-		// blocks (e.g. table, list, pre) at the end of document, make this happen by
-		// place a bogus node there, which would be later removed by dataprocessor.
-		var walkerRange = new CKEDITOR.dom.range( editor.document ),
-			walker = new CKEDITOR.dom.walker( walkerRange );
-		walkerRange.selectNodeContents( body );
-		walker.evaluator = function( node )
-		{
-			return node.type == CKEDITOR.NODE_ELEMENT && ( node.getName() in nonExitableElementNames );
-		};
-		walker.guard = function( node, isMoveout )
-		{
-			return !( ( node.type == CKEDITOR.NODE_TEXT && isNotWhitespace( node ) ) || isMoveout );
-		};
-
-		if ( walker.previous() )
+		// Browsers are incapable of moving cursor out of certain block elements (e.g. table, div, pre)
+		// at the end of document, makes it unable to continue adding content, we have to make this
+		// easier by opening an new empty paragraph.
+		var testRange = new CKEDITOR.dom.range( editor.document );
+		testRange.moveToElementEditEnd( editor.document.getBody() );
+		var testPath = new CKEDITOR.dom.elementPath( testRange.startContainer );
+		if ( !testPath.blockLimit.is( 'body') )
 		{
 			editor.fire( 'updateSnapshot' );
Index: /CKEditor/branches/versions/3.6.x/_source/themes/default/theme.js
===================================================================
--- /CKEditor/branches/versions/3.6.x/_source/themes/default/theme.js	(revision 6779)
+++ /CKEditor/branches/versions/3.6.x/_source/themes/default/theme.js	(revision 6780)
@@ -11,4 +11,6 @@
 CKEDITOR.themes.add( 'default', (function()
 {
+	var hiddenSkins = {};
+
 	function checkSharedSpace( editor, spaceName )
 	{
@@ -121,4 +123,10 @@
 			sharedTop		&& ( sharedTop.setHtml( topHtml )		, topHtml = '' );
 			sharedBottoms	&& ( sharedBottoms.setHtml( bottomHtml ), bottomHtml = '' );
+
+			var hideSkin = '<style>.' + editor.skinClass + '{visibility:hidden;}</style>';
+			if ( hiddenSkins[ editor.skinClass ] )
+				hideSkin = '';
+			else
+				hiddenSkins[ editor.skinClass ] = 1;
 
 			var container = CKEDITOR.dom.element.createFromHtml( [
@@ -143,5 +151,5 @@
 							'</tbody></table>' +
 							//Hide the container when loading skins, later restored by skin css.
-							'<style>.', editor.skinClass, '{visibility:hidden;}</style>' +
+							hideSkin +
 						'</span>' +
 					'</span>' +
