Skip to content

Commit

Permalink
Merge branch 't/9853'
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Dec 20, 2012
2 parents b18813c + 3933bf4 commit eaa08e6
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions plugins/removeformat/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ CKEDITOR.plugins.add( 'removeformat', {
command: 'removeFormat',
toolbar: 'cleanup,10'
});

editor._.removeFormat = { filters: [] };
}
});

Expand Down Expand Up @@ -113,7 +111,8 @@ CKEDITOR.plugins.removeformat = {
// @param {CKEDITOR.editor} editor
// @param {CKEDITOR.dom.element} element
filter: function( editor, element ) {
var filters = editor._.removeFormat.filters;
// If editor#addRemoveFotmatFilter hasn't been executed yet value is not initialized.
var filters = editor._.removeFormatFilters || [];
for ( var i = 0; i < filters.length; i++ ) {
if ( filters[ i ]( element ) === false )
return false;
Expand All @@ -129,8 +128,8 @@ CKEDITOR.plugins.removeformat = {
*
* **Note:** Only available with the existence of `removeformat` plugin.
*
* // Don't remove empty span
* editor.addRemoveFormatFilter.push( function( element ) {
* // Don't remove empty span.
* editor.addRemoveFormatFilter( function( element ) {
* return !( element.is( 'span' ) && CKEDITOR.tools.isEmpty( element.getAttributes() ) );
* } );
*
Expand All @@ -139,7 +138,10 @@ CKEDITOR.plugins.removeformat = {
* @param {Function} func The function to be called, which will be passed a {CKEDITOR.dom.element} element to test.
*/
CKEDITOR.editor.prototype.addRemoveFormatFilter = function( func ) {
this._.removeFormat.filters.push( func );
if ( !this._.removeFormatFilters )
this._.removeFormatFilters = [];

this._.removeFormatFilters.push( func );
};

/**
Expand Down

0 comments on commit eaa08e6

Please sign in to comment.