Ticket #3710: 3710.patch

File 3710.patch, 1.4 KB (added by Martin Kou, 15 years ago)
  • _source/plugins/htmldataprocessor/plugin.js

     
    191191                return html.replace( protectAttributeRegex, '$& _cke_saved_$1' );
    192192        }
    193193
     194        var protectStyleTagsRegex = /(<\/?)style(?=[^0-9A-Za-z])/gi;
     195        var unprotectStyleTagsRegex = /(<\/?)cke:style(?=[^0-9A-Za-z])/gi;
     196
    194197        CKEDITOR.plugins.add( 'htmldataprocessor',
    195198        {
    196199                requires : [ 'htmlwriter' ],
     
    227230                        // the code.
    228231                        data = protectAttributes( data );
    229232
     233                        // IE remvoes style tags from innerHTML. (#3710).
     234                        if ( CKEDITOR.env.ie )
     235                                data = data.replace( protectStyleTagsRegex, '$1cke:style' );
     236
    230237                        // Call the browser to help us fixing a possibly invalid HTML
    231238                        // structure.
    232239                        var div = document.createElement( 'div' );
    233240                        div.innerHTML = data;
     241                        data = div.innerHTML;
    234242
     243                        if ( CKEDITOR.env.ie )
     244                                data = data.replace( unprotectStyleTagsRegex, '$1style' );
     245
    235246                        // Now use our parser to make further fixes to the structure, as
    236247                        // well as apply the filter.
    237                         var fragment = CKEDITOR.htmlParser.fragment.fromHtml( div.innerHTML, fixForBody ),
     248                        var fragment = CKEDITOR.htmlParser.fragment.fromHtml( data, fixForBody ),
    238249                                writer = new CKEDITOR.htmlParser.basicWriter();
    239250
    240251                        fragment.writeHtml( writer, this.dataFilter );
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy