| 8 |  | **Below are some incomplete solutions:** | 
                      
                        |  | 8 | Below I have presented some incomplete solutions (**just put code in config.js**). You may ask why Incomplete? [[BR]] | 
                        |  | 9 | The below semi-solutions work on initial data or when switching to source and back or when pasting with CRTL+V, but they don’t work with plugins that insert these particular tags. | 
                        |  | 10 |  | 
                        |  | 11 | The new feature here might be some white-list/ black-list or simply list based filter that would: | 
                        |  | 12 | * remove tags that are on the black-list | 
                        |  | 13 | * remove tags that are on the black-list but depending on some filter configuration setting it would leave or remove tag contents. | 
                        |  | 14 | * would change tags that are on black-list to other tags that are on white-list. | 
                        |  | 15 | * “Which tags should be changed to which” should be also defined in configuration option (something that user can define), perhaps in form of an object where properties are tag names: | 
                        |  | 16 | {{{ | 
                        |  | 17 | var myFilterList = { | 
                        |  | 18 | a : '', | 
                        |  | 19 | strong : 'b', | 
                        |  | 20 | img : 'img:span' | 
                        |  | 21 | } | 
                        |  | 22 | }}} | 
                        |  | 23 | * Please note that object used above can tell filter to remove tag (a : ''), change it (strong : 'b'), or wrap it (img : 'img:span'). | 
                        |  | 24 |  | 
                        |  | 25 |  | 
                        |  | 26 | ---- | 
                        |  | 27 | This code wrap images in spans | 
            
                      
                        | 11 |  | 'pluginsLoaded' : function( evt ){ //it must be done before "instanceReady" to make the tag blocking in effect | 
                        | 12 |  | evt.editor.dataProcessor.dataFilter.addRules({ | 
                        | 13 |  | elements :{ | 
                        | 14 |  | span : function( element ) { | 
                        | 15 |  | //the rule for img is dumm as it keeps adding span tags the idea is to remove span and let img add it | 
                        | 16 |  | if ( element._processed ) | 
                        | 17 |  | return; | 
                        | 18 |  | if(element.attributes.id == 'cke_image_s_wrapper') | 
                        | 19 |  | delete element.name; | 
                        | 20 |  | }, | 
                        | 21 |  | img : function( element ) | 
                        | 22 |  | { | 
                        | 23 |  | if ( element._processed ) | 
                        | 24 |  | return; | 
                        | 25 |  | element._processed = 1; | 
                        | 26 |  | element.alt = (!element.attributes.alt ? element.attributes.alt : 'An image'); | 
                        | 27 |  |  | 
                        | 28 |  | var parent = new CKEDITOR.htmlParser.element('span'); | 
                        | 29 |  | parent.attributes.style='border:10px solid #f00;display: inline-block;'; | 
                        | 30 |  | parent.attributes.id='cke_image_s_wrapper'; | 
                        | 31 |  | parent.add(element); | 
                        | 32 |  | parent._processed = 1 | 
                        | 33 |  | return parent; | 
                        | 34 |  | } | 
                        | 35 |  | } | 
                        | 36 |  | }); | 
                        | 37 |  | } | 
                      
                        |  | 30 | 'pluginsLoaded' : function( evt ){ //it must be done before "instanceReady" to make the tag blocking in effect | 
                        |  | 31 | evt.editor.dataProcessor.dataFilter.addRules({ | 
                        |  | 32 | elements :{ | 
                        |  | 33 | span : function( element ) { | 
                        |  | 34 | //the rule for img is dumm as it keeps adding span tags the idea is to remove span and let img add it | 
                        |  | 35 | if ( element._processed ) | 
                        |  | 36 | return; | 
                        |  | 37 | if(element.attributes.id == 'cke_image_s_wrapper') | 
                        |  | 38 | delete element.name; | 
                        |  | 39 | }, | 
                        |  | 40 | img : function( element ) | 
                        |  | 41 | { | 
                        |  | 42 | if ( element._processed ) | 
                        |  | 43 | return; | 
                        |  | 44 | element._processed = 1; | 
                        |  | 45 | element.alt = (!element.attributes.alt ? element.attributes.alt : 'An image'); | 
                        |  | 46 | var parent = new CKEDITOR.htmlParser.element('span'); | 
                        |  | 47 | parent.attributes.style='border:10px solid #f00;display: inline-block;'; | 
                        |  | 48 | parent.attributes.id='cke_image_s_wrapper'; | 
                        |  | 49 | parent.add(element); | 
                        |  | 50 | parent._processed = 1 | 
                        |  | 51 | return parent; |