Index: /CKEditor/trunk/CHANGES.html
===================================================================
--- /CKEditor/trunk/CHANGES.html	(revision 5422)
+++ /CKEditor/trunk/CHANGES.html	(revision 5423)
@@ -66,4 +66,5 @@
 		<li><a href="http://dev.fckeditor.net/ticket/4358">#4358</a> : Aligning <b>List Properties</b> dialog with FCKEditor 2.x.</li>
 		<li><a href="http://dev.fckeditor.net/ticket/5485">#5485</a> : Adding the <b>contentsLanguage</b> configuration option.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/5402">#5402</a> : Shift-Enter could now be used to exit from preformat block.</li>
 	</ul>
 	<p>
Index: /CKEditor/trunk/_source/core/dom/element.js
===================================================================
--- /CKEditor/trunk/_source/core/dom/element.js	(revision 5422)
+++ /CKEditor/trunk/_source/core/dom/element.js	(revision 5423)
@@ -1473,5 +1473,5 @@
 
 			// Replace the node.
-			this.$.parentNode.replaceChild( newNode.$, this.$ );
+			this.getParent() && this.$.parentNode.replaceChild( newNode.$, this.$ );
 			newNode.$._cke_expando = this.$._cke_expando;
 			this.$ = newNode.$;
Index: /CKEditor/trunk/_source/plugins/enterkey/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/enterkey/plugin.js	(revision 5422)
+++ /CKEditor/trunk/_source/plugins/enterkey/plugin.js	(revision 5423)
@@ -293,7 +293,19 @@
 	function shiftEnter( editor )
 	{
-		// On SHIFT+ENTER we want to enforce the mode to be respected, instead
+		// Only effective within document.
+		if ( editor.mode != 'wysiwyg' )
+			return false;
+
+		// On SHIFT+ENTER:
+		// 1. We want to enforce the mode to be respected, instead
 		// of cloning the current block. (#77)
-		return enter( editor, editor.config.shiftEnterMode, true );
+		// 2. Always perform a block break when inside <pre> (#5402).
+		if ( editor.getSelection().getStartElement().hasAscendant( 'pre', true ) )
+		{
+			setTimeout( function() { enterBlock( editor, editor.config.enterMode, null, true ); }, 0 );
+			return true;
+		}
+		else
+			return enter( editor, editor.config.shiftEnterMode, true );
 	}
 
