Index: _source/core/tools.js
===================================================================
--- _source/core/tools.js (revision 3477)
+++ _source/core/tools.js Tue Jun 02 20:36:24 CST 2009
@@ -169,6 +169,20 @@
},
/**
+ * Treats any object as a hashtable and fetches the list of its property names.
+ * Note: There's no guarantee on declaration or lexicographical order.
+ * @param object
+ */
+ keys: function( object )
+ {
+ var results = [];
+ for ( var property in object )
+ if ( object.hasOwnProperty( property ) )
+ results.push( property );
+ return results;
+ },
+
+ /**
* Transforms a CSS property name to its relative DOM style name.
* @param {String} cssName The CSS property name.
* @returns {String} The transformed name.
Index: _source/plugins/wysiwygarea/plugin.js
===================================================================
--- _source/plugins/wysiwygarea/plugin.js (revision 3549)
+++ _source/plugins/wysiwygarea/plugin.js Tue Jun 02 16:56:28 CST 2009
@@ -371,7 +371,9 @@
},
0 );
};
-
+ var emptyParagraphRegexp = new RegExp( "\\s*<(" +
+ CKEDITOR.tools.keys( CKEDITOR.dtd.$block ).join('|') +
+ ")[^>]*>\\s*(?:
]*>| | )\\s*(:?\\1>)?\\s*$", "i" );
editor.addMode( 'wysiwyg',
{
load : function( holderElement, data, isSnapshot )
@@ -456,6 +458,10 @@
if ( editor.dataProcessor )
data = editor.dataProcessor.toDataFormat( data, ( editor.config.enterMode != CKEDITOR.ENTER_BR ) );
+ // Strip single empty paragraph within document.
+ if ( editor.config.ignoreEmptyParagraph &&
+ emptyParagraphRegexp.test( data ) )
+ data = '';
return data;
},
@@ -533,3 +539,11 @@
* config.disableNativeSpellChecker = false;
*/
CKEDITOR.config.disableNativeSpellChecker = true;
+/**
+ * The editor will post an empty value ("") if you have just an empty paragraph on it, like this:
+ * @example
+ *
+ */ +CKEDITOR.config.ignoreEmptyParagraph = true;