﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
8726	Allow for  filtering HTML data	Jakub Ś		"This ticket is related to - #588

Some clients ask about possibility to filter/block/modify certain HTML elements E.g.
1. Remove all elements except strong and u tags and text nodes that are inside forbidden elements.
2. Delete all a tags but leave their contents
3. Wrap all images in spans

**Below are some incomplete solutions:**
{{{
on :{
					'pluginsLoaded' : function( evt ){ //it must be done before ""instanceReady"" to make the tag blocking in effect
						evt.editor.dataProcessor.dataFilter.addRules({
							elements :{
								span : function( element ) {
									//the rule for img is dumm as it keeps adding span tags the idea is to remove span and let img add it
									if ( element._processed )
										return;
									if(element.attributes.id == 'cke_image_s_wrapper')
										delete element.name;
								},
								img : function( element )
								{
									if ( element._processed )
										return;
									element._processed = 1;
									element.alt = (!element.attributes.alt ? element.attributes.alt : 'An image');

									var parent = new CKEDITOR.htmlParser.element('span');
									parent.attributes.style='border:10px solid #f00;display: inline-block;';
									parent.attributes.id='cke_image_s_wrapper';
									parent.add(element);
									parent._processed = 1
									return parent;
								}
							}
						});
					}
				}
}}}

{{{
on :
					  {
						  'pluginsLoaded' : function( evt )  //it must be done before ""instanceReady"" to make the tag blocking in effect
						  {							  
							  evt.editor.dataProcessor.dataFilter.addRules(
									  {
										  elements :
										  {
											a : function( element ) 
											{													
												delete element.name												
											}								
										  }
									  } );
						  }
					  }
}}}


**Why incomplete?**[[BR]]
This works on initial data, when switching to source and back, when pasting but it does not work with plugins (for the above with image and link plugins).

The solution here might be some plugin-filter through which all data would have to go through when it is enabled in configuration options.

For such plugin used could define a set of rules according to his needs (perhaps again in configuration option?).
"	New Feature	new	Normal		General	3.0			
