Ticket #1502: 1502_2.patch

File 1502_2.patch, 3.1 KB (added by alfonsoml, 2 years ago)

Revised patch

  • _whatsnew.html

     
    138138                        resolved issues with OnRequestEnd.cfm breaking the file browser.</li> 
    139139                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1509">#1509</a>] InsertHtml() in IE will no 
    140140                        longer turn the preceding normal whitespace into &amp;nbsp;.</li> 
     141                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1502">#1502</a>] The RemoveFormat command now 
     142                        also removes the attributes from the cleaned text. The list of attributes is configurable with  
     143                        FCKConfig.RemoveAttributes.</li> 
    141144        </ul> 
    142145        <p> 
    143146                <a href="_whatsnew_history.html">See previous versions history</a> 
  • editor/_source/internals/fckconfig.js

     
    135135        var sComboPreviewCSS = oConfig.ToolbarComboPreviewCSS ; 
    136136        if ( !sComboPreviewCSS || sComboPreviewCSS.length == 0 ) 
    137137                oConfig.ToolbarComboPreviewCSS = oConfig.EditorAreaCSS ; 
     138 
     139        // Turn the attributes that will be removed in the RemoveFormat from a string to an array 
     140        oConfig.RemoveAttributesArray = (oConfig.RemoveAttributes || '').split( ',' ); 
    138141} 
    139142 
    140143// Define toolbar sets collection. 
  • editor/_source/internals/fckdomtools.js

     
    517517                return element.removeAttribute( attributeName, 0 ) ; 
    518518        }, 
    519519 
     520        /** 
     521         * Removes an array of attributes from an element 
     522         */ 
     523        RemoveAttributes : function (element, aAttributes ) 
     524        { 
     525                for ( var i = 0 ; i < aAttributes.length ; i++ ) 
     526                        this.RemoveAttribute( element, aAttributes[i] ); 
     527        },  
     528 
    520529        GetAttributeValue : function( element, att ) 
    521530        { 
    522531                var attName = att ; 
  • editor/_source/internals/fckstyles.js

     
    210210                        // Remove elements nodes that match with this style rules. 
    211211                        if ( tagsRegex.test( currentNode.nodeName ) ) 
    212212                                FCKDomTools.RemoveNode( currentNode, true ) ; 
     213                        else 
     214                                FCKDomTools.RemoveAttributes( currentNode, FCKConfig.RemoveAttributesArray ); 
    213215 
    214216                        currentNode = nextNode ; 
    215217                } 
  • fckconfig.js

     
    192192// Only inline elements are valid. 
    193193FCKConfig.RemoveFormatTags = 'b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var' ; 
    194194 
     195// Attributes that will be removed  
     196FCKConfig.RemoveAttributes = 'class,style,lang,width,height,align,hspace,valign' ; 
     197 
    195198FCKConfig.CustomStyles = 
    196199{ 
    197200        'Red Title'     : { Element : 'h3', Styles : { 'color' : 'Red' } }