Ticket #5218: 5218.2.patch

File 5218.2.patch, 1.4 KB (added by Sa'ar Zac Elias, 14 years ago)
  • _source/plugins/htmldataprocessor/plugin.js

     
    263263                defaultHtmlFilterRules.elements[ i ] = unprotectReadyOnly;
    264264        }
    265265
    266         var protectAttributeRegex = /<(?:a|area|img|input)[\s\S]*?\s((?:href|src|name)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+)))/gi;
     266        var protectAttributeRegex = /<((?:a|area|img|input)[\s\S]*?\s)((href|src|name)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+)))([^>]*)>/gi,
     267                findSavedSrcRegex = /\s_cke_saved_src\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+))/;
    267268
    268269        var protectElementsRegex = /(?:<style(?=[ >])[^>]*>[\s\S]*<\/style>)|(?:<(:?link|meta|base)[^>]*>)/gi,
    269270                encodedElementsRegex = /<cke:encoded>([^<]*)<\/cke:encoded>/gi;
     
    275276
    276277        function protectAttributes( html )
    277278        {
    278                 return html.replace( protectAttributeRegex, '$& _cke_saved_$1' );
     279                return html.replace( protectAttributeRegex, function( tag, beginning, fullAttr, attrName, end )
     280                        {
     281                                // We should not rewrite the _cke_saved_src attribute (#5218)
     282                                if ( attrName == 'src' && findSavedSrcRegex.test( tag ) )
     283                                        return tag;
     284                                else
     285                                        return '<' + beginning + fullAttr + ' _cke_saved_' + fullAttr + end + '>';
     286                        });
    279287        }
    280288
    281289        function protectElements( html )
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy