X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fhtmlwriter%2Fplugin.js;h=b4f766ad2803722ae077150fe07cf8767bbb8d28;hp=46faddec28f865127cc1fb40dfc7da9d93ad60f1;hb=039a051ccf3901311661022a30afd60fc38130c9;hpb=c9fdde67e6384bd5a66adc2b3bba5c4ce9db56c7 diff --git a/_source/plugins/htmlwriter/plugin.js b/_source/plugins/htmlwriter/plugin.js index 46fadde..b4f766a 100644 --- a/_source/plugins/htmlwriter/plugin.js +++ b/_source/plugins/htmlwriter/plugin.js @@ -57,12 +57,14 @@ CKEDITOR.htmlWriter = CKEDITOR.tools.createClass( */ this.lineBreakChars = '\n'; - this.forceSimpleAmpersand = false; + this.forceSimpleAmpersand = 0; - this.sortAttributes = true; + this.sortAttributes = 1; - this._.indent = false; + this._.indent = 0; this._.indentation = ''; + // Indicate preformatted block context status. (#5789) + this._.inPre = 0; this._.rules = {}; var dtd = CKEDITOR.dtd; @@ -71,35 +73,35 @@ CKEDITOR.htmlWriter = CKEDITOR.tools.createClass( { this.setRules( e, { - indent : true, - breakBeforeOpen : true, - breakAfterOpen : true, + indent : 1, + breakBeforeOpen : 1, + breakAfterOpen : 1, breakBeforeClose : !dtd[ e ][ '#' ], - breakAfterClose : true + breakAfterClose : 1 }); } this.setRules( 'br', { - breakAfterOpen : true + breakAfterOpen : 1 }); this.setRules( 'title', { - indent : false, - breakAfterOpen : false + indent : 0, + breakAfterOpen : 0 }); this.setRules( 'style', { - indent : false, - breakBeforeClose : true + indent : 0, + breakBeforeClose : 1 }); // Disable indentation on
.
 		this.setRules( 'pre',
 			{
-			  indent: false
+			  indent : 0
 			});
 	},
 
@@ -158,6 +160,7 @@ CKEDITOR.htmlWriter = CKEDITOR.tools.createClass(
 
 			if ( rules && rules.breakAfterOpen )
 				this.lineBreak();
+			tagName == 'pre' && ( this._.inPre = 1 );
 		},
 
 		/**
@@ -206,6 +209,7 @@ CKEDITOR.htmlWriter = CKEDITOR.tools.createClass(
 			}
 
 			this._.output.push( '' );
+			tagName == 'pre' && ( this._.inPre = 0 );
 
 			if ( rules && rules.breakAfterClose )
 				this.lineBreak();
@@ -223,7 +227,7 @@ CKEDITOR.htmlWriter = CKEDITOR.tools.createClass(
 			if ( this._.indent )
 			{
 				this.indentation();
-				text = CKEDITOR.tools.ltrim( text );
+				!this._.inPre  && ( text = CKEDITOR.tools.ltrim( text ) );
 			}
 
 			this._.output.push( text );
@@ -252,9 +256,9 @@ CKEDITOR.htmlWriter = CKEDITOR.tools.createClass(
 		 */
 		lineBreak : function()
 		{
-			if ( this._.output.length > 0 )
+			if ( !this._.inPre && this._.output.length > 0 )
 				this._.output.push( this.lineBreakChars );
-			this._.indent = true;
+			this._.indent = 1;
 		},
 
 		/**
@@ -267,8 +271,9 @@ CKEDITOR.htmlWriter = CKEDITOR.tools.createClass(
 		 */
 		indentation : function()
 		{
-			this._.output.push( this._.indentation );
-			this._.indent = false;
+			if( !this._.inPre )
+				this._.output.push( this._.indentation );
+			this._.indent = 0;
 		},
 
 		/**