Index: /CKEditor/trunk/CHANGES.html =================================================================== --- /CKEditor/trunk/CHANGES.html (revision 5952) +++ /CKEditor/trunk/CHANGES.html (revision 5953) @@ -132,4 +132,5 @@
]*>)(\r\n|\n)/g, '$1$2$2' ); } @@ -437,4 +442,8 @@ // protecting them into open-close. (#3591) data = protectSelfClosingElements( data ); + + // Compensate one leading line break afteropen as browsers + // eat it up. (#5789) + data = protectPreFormatted( data ); // Call the browser to help us fixing a possibly invalid HTML Index: /CKEditor/trunk/_source/plugins/htmlwriter/plugin.js =================================================================== --- /CKEditor/trunk/_source/plugins/htmlwriter/plugin.js (revision 5952) +++ /CKEditor/trunk/_source/plugins/htmlwriter/plugin.js (revision 5953) @@ -64,4 +64,6 @@ this._.indent = 0; this._.indentation = ''; + // Indicate preformatted block context status. (#5789) + this._.inPre = 0; this._.rules = {}; @@ -159,4 +161,5 @@ if ( rules && rules.breakAfterOpen ) this.lineBreak(); + tagName == 'pre' && ( this._.inPre = 1 ); }, @@ -207,4 +210,5 @@ this._.output.push( '', tagName, '>' ); + tagName == 'pre' && ( this._.inPre = 0 ); if ( rules && rules.breakAfterClose ) @@ -224,5 +228,5 @@ { this.indentation(); - text = CKEDITOR.tools.ltrim( text ); + !this._.inPre && ( text = CKEDITOR.tools.ltrim( text ) ); } @@ -253,5 +257,5 @@ lineBreak : function() { - if ( this._.output.length > 0 ) + if ( !this._.inPre && this._.output.length > 0 ) this._.output.push( this.lineBreakChars ); this._.indent = 1; @@ -268,5 +272,6 @@ indentation : function() { - this._.output.push( this._.indentation ); + if( !this._.inPre ) + this._.output.push( this._.indentation ); this._.indent = 0; },