X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fhtmlwriter%2Fplugin.js;h=46faddec28f865127cc1fb40dfc7da9d93ad60f1;hb=e7789c1ad838194d45eeee6ac2eb6e55f5cf35a1;hp=c0dea03893db3a6b373fac9cb35b52853643bb3a;hpb=ea7e3453c7b0f023b050aca6d9f83ab372860d91;p=ckeditor.git diff --git a/_source/plugins/htmlwriter/plugin.js b/_source/plugins/htmlwriter/plugin.js index c0dea03..46fadde 100644 --- a/_source/plugins/htmlwriter/plugin.js +++ b/_source/plugins/htmlwriter/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -67,7 +67,7 @@ CKEDITOR.htmlWriter = CKEDITOR.tools.createClass( var dtd = CKEDITOR.dtd; - for ( var e in CKEDITOR.tools.extend( {}, dtd.$block, dtd.$listItem, dtd.$tableContent ) ) + for ( var e in CKEDITOR.tools.extend( {}, dtd.$nonBodyContent, dtd.$block, dtd.$listItem, dtd.$tableContent ) ) { this.setRules( e, { @@ -78,15 +78,29 @@ CKEDITOR.htmlWriter = CKEDITOR.tools.createClass( breakAfterClose : true }); } + this.setRules( 'br', { breakAfterOpen : true }); + + this.setRules( 'title', + { + indent : false, + breakAfterOpen : false + }); + + this.setRules( 'style', + { + indent : false, + breakBeforeClose : true + }); + // Disable indentation on
.
 		this.setRules( 'pre',
-		{
-		  indent: false
-		} );
+			{
+			  indent: false
+			});
 	},
 
 	proto :
@@ -157,8 +171,13 @@ CKEDITOR.htmlWriter = CKEDITOR.tools.createClass(
 		 */
 		attribute : function( attName, attValue )
 		{
-			if ( this.forceSimpleAmpersand )
-				attValue = attValue.replace( /&/, '&' );
+
+			if ( typeof attValue == 'string' )
+			{
+				this.forceSimpleAmpersand && ( attValue = attValue.replace( /&/g, '&' ) );
+				// Browsers don't always escape special character in attribute values. (#4683, #4719).
+				attValue = CKEDITOR.tools.htmlEncodeAttr( attValue );
+			}
 
 			this._.output.push( ' ', attName, '="', attValue, '"' );
 		},
@@ -262,7 +281,8 @@ CKEDITOR.htmlWriter = CKEDITOR.tools.createClass(
 		 *	
  • breakAfterClose: break line after the closer tag for this element.
  • * * - * All rules default to "false". + * All rules default to "false". Each call to the function overrides + * already present rules, leaving the undefined untouched. * * By default, all elements available in the {@link CKEDITOR.dtd.$block), * {@link CKEDITOR.dtd.$listItem} and {@link CKEDITOR.dtd.$tableContent} @@ -283,7 +303,12 @@ CKEDITOR.htmlWriter = CKEDITOR.tools.createClass( */ setRules : function( tagName, rules ) { - this._.rules[ tagName ] = rules; + var currentRules = this._.rules[ tagName ]; + + if ( currentRules ) + CKEDITOR.tools.extend( currentRules, rules, true ); + else + this._.rules[ tagName ] = rules; } } });