Index: _source/plugins/htmldataprocessor/plugin.js
===================================================================
--- _source/plugins/htmldataprocessor/plugin.js (revision 5241)
+++ _source/plugins/htmldataprocessor/plugin.js Fri Apr 16 17:23:41 CST 2010
@@ -38,36 +38,31 @@
}
}
- function blockNeedsExtension( block )
+ function blockNeedsExtension( block, extendEmptyBlock )
{
var lastChild = lastNoneSpaceChild( block );
- return !lastChild
- || lastChild.type == CKEDITOR.NODE_ELEMENT && lastChild.name == 'br'
+ return extendEmptyBlock && !lastChild
+ || lastChild &&
+ ( lastChild.type == CKEDITOR.NODE_ELEMENT && lastChild.name == 'br'
- // Some of the controls in form needs extension too,
- // to move cursor at the end of the form. (#4791)
+ // Some of the controls in form needs extension too,
+ // to move cursor at the end of the form. (#4791)
- || block.name == 'form' && lastChild.name == 'input';
+ || block.name == 'form' && lastChild.name == 'input' );
}
- function extendBlockForDisplay( block )
+ function getBlockExtension( isOutput, emptyBlockFiller )
{
- trimFillers( block, true );
-
- if ( blockNeedsExtension( block ) )
+ return function( node )
{
- if ( CKEDITOR.env.ie )
- block.add( new CKEDITOR.htmlParser.text( '\xa0' ) );
+ trimFillers( node, !isOutput );
+ if ( blockNeedsExtension( node, !isOutput || emptyBlockFiller ) )
+ {
+ if ( isOutput || CKEDITOR.env.ie )
+ node.add( new CKEDITOR.htmlParser.text( '\xa0' ) );
- else
+ else
- block.add( new CKEDITOR.htmlParser.element( 'br', {} ) );
+ node.add( new CKEDITOR.htmlParser.element( 'br', {} ) );
- }
- }
+ }
+ }
-
- function extendBlockForOutput( block )
- {
- trimFillers( block );
-
- if ( blockNeedsExtension( block ) )
- block.add( new CKEDITOR.htmlParser.text( '\xa0' ) );
}
var dtd = CKEDITOR.dtd;
@@ -95,7 +90,7 @@
var defaultDataBlockFilterRules = { elements : {} };
for ( i in blockLikeTags )
- defaultDataBlockFilterRules.elements[ i ] = extendBlockForDisplay;
+ defaultDataBlockFilterRules.elements[ i ] = getBlockExtension();
var defaultHtmlFilterRules =
{
@@ -225,11 +220,6 @@
}
};
- var defaultHtmlBlockFilterRules = { elements : {} };
-
- for ( i in blockLikeTags )
- defaultHtmlBlockFilterRules.elements[ i ] = extendBlockForOutput;
-
if ( CKEDITOR.env.ie )
{
// IE outputs style attribute in capital letters. We should convert
@@ -367,6 +357,11 @@
dataProcessor.dataFilter.addRules( defaultDataFilterRules );
dataProcessor.dataFilter.addRules( defaultDataBlockFilterRules );
dataProcessor.htmlFilter.addRules( defaultHtmlFilterRules );
+
+ var defaultHtmlBlockFilterRules = { elements : {} };
+ for ( i in blockLikeTags )
+ defaultHtmlBlockFilterRules.elements[ i ] = getBlockExtension( true, editor.config.fillEmptyBlocks !== false );
+
dataProcessor.htmlFilter.addRules( defaultHtmlBlockFilterRules );
}
});
@@ -461,3 +459,13 @@
* config.forceSimpleAmpersand = false;
*/
CKEDITOR.config.forceSimpleAmpersand = false;
+
+/**
+ * Whether editor output will insert the non-breaking space entity ( ) into empty block elements.
+ * @name CKEDITOR.config.fillEmptyBlocks;
+ * @type Boolean
+ * @default true
+ * @example
+ * config.fillEmptyBlocks = false;
+ */
+