Skip to content

Commit

Permalink
Merge branch 't/10260'
Browse files Browse the repository at this point in the history
  • Loading branch information
oleq committed Apr 16, 2013
2 parents 94f756e + 5441ee9 commit d84ac37
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -11,6 +11,7 @@ CKEditor 4 Changelog
* [#9995](http://dev.ckeditor.com/ticket/9995): HTML in `textarea` should not be modified by the `htmlDataProcessor`.
* [#10315](http://dev.ckeditor.com/ticket/10315): [Webkit] Undo manager should not record snapshots after filling char has been added/removed.
* [#10320](http://dev.ckeditor.com/ticket/10320): Justify plugin should add elements to the ACF based on current enter mode.
* [#10260](http://dev.ckeditor.com/ticket/10260): Fixed: Advanced Content Filter blocks tabSpaces. Unified `data-cke-*` attributes filtering.

## CKEditor 4.1

Expand Down
29 changes: 20 additions & 9 deletions core/filter.js
Expand Up @@ -278,15 +278,26 @@

// Filter all children, skip root (fragment or editable-like wrapper used by data processor).
fragment.forEach( function( el ) {
if ( el.type == CKEDITOR.NODE_ELEMENT ) {
if ( filterFn( el, rules, transformations, toBeRemoved, toHtml ) )
isModified = true;
}
else if ( el.type == CKEDITOR.NODE_COMMENT && el.value.match( /^\{cke_protected\}(?!\{C\})/ ) ) {
if ( !filterProtectedElement( el, protectedRegexs, filterFn, rules, transformations, toHtml ) )
toBeRemoved.push( el );
}
}, null, true );
if ( el.type == CKEDITOR.NODE_ELEMENT ) {
// (#10260) Don't touch elements like spans with data-cke-* attribute since they're
// responsible e.g. for placing markers, bookmarks, odds and stuff.
// We love 'em and we don't wanna lose anything during the filtering.
// '|' is to avoid tricky joints like data-="foo" + cke-="bar". Yes, they're possible.
//
// NOTE: data-cke-* assigned elements are preserved only when filter is used with
// htmlDataProcessor.toHtml because we don't want to protect them when outputting data
// (toDataFormat).
if ( toHtml && el.name == 'span' && ~CKEDITOR.tools.objectKeys( el.attributes ).join( '|' ).indexOf( 'data-cke-' ) )
return;

if ( filterFn( el, rules, transformations, toBeRemoved, toHtml ) )
isModified = true;
}
else if ( el.type == CKEDITOR.NODE_COMMENT && el.value.match( /^\{cke_protected\}(?!\{C\})/ ) ) {
if ( !filterProtectedElement( el, protectedRegexs, filterFn, rules, transformations, toHtml ) )
toBeRemoved.push( el );
}
}, null, true );

if ( toBeRemoved.length )
isModified = true;
Expand Down

0 comments on commit d84ac37

Please sign in to comment.