Ticket #3441: 3441_3.patch

File 3441_3.patch, 2.7 KB (added by Garry Yao, 15 years ago)
  • _source/plugins/htmlwriter/plugin.js

     
    195195                 * // Writes "Hello Word".
    196196                 * writer.text( 'Hello Word' );
    197197                 */
    198                 text : function( text )
     198                text : function( text, isCDATA )
    199199                {
    200200                        if ( this._.indent )
    201201                        {
     
    202202                                this.indentation();
    203203                                text = CKEDITOR.tools.ltrim( text );
    204204                        }
    205 
    206                         this._.output.push( text );
     205                        if ( isCDATA )
     206                                this._.output.push( '<![CDATA[', text, ']]>' );
     207                        else
     208                                this._.output.push( text );
    207209                },
    208210
    209211                /**
  • _source/core/htmlparser/text.js

     
    55
    66(function()
    77{
    8         var spacesRegex = /[\t\r\n ]{2,}|[\t\r\n]/g;
     8        // cdataNode : Element tag names which contains CDATA data type.
     9        var spacesRegex = /[\t\r\n ]{2,}|[\t\r\n]/g,
     10                cdataNode = { script : 1, style : 1 };         
    911
    1012        /**
    1113         * A lightweight representation of HTML text.
     
    1214         * @constructor
    1315         * @example
    1416         */
    15         CKEDITOR.htmlParser.text = function( value )
     17        CKEDITOR.htmlParser.text = function( value )
    1618        {
    1719                /**
    1820                 * The text value.
     
    4446                 */
    4547                writeHtml : function( writer, filter )
    4648                {
    47                         var text = this.value;
     49                        var text = this.value,
     50                                textType =
     51                                        this.parent.name in cdataNode ? 'CDATA' : 'Text';
    4852
    49                         if ( filter && !( text = filter.onText( text ) ) )
     53                        if ( filter && !( text = filter[ 'on' + textType ].call( filter, text ) ) )
    5054                                return;
    5155
    52                         writer.text( text );
     56                        writer.text( text, textType  == 'CDATA' );
    5357                }
    5458        };
    5559})();
  • _source/core/htmlparser/filter.js

     
    5656                        {
    5757                                return filterName( name, this._.attributeNames );
    5858                        },
    59 
     59                       
     60                        /**
     61                         * Filtering text node content.
     62                         * @param {Object} text The text content.
     63                         */
    6064                        onText : function( text )
    6165                        {
    6266                                var textFilter = this._.text;
     
    6266                                var textFilter = this._.text;
    6367                                return textFilter ? textFilter.filter( text ) : text;
    6468                        },
     69       
     70                        /**
     71                         * Filtering CDATA section content.
     72                         */
     73                        onCDATA : function( cdata )
     74                        {
     75                                var filter = this._.cdata;
     76                                return filter ? filter.filter( cdata ) : cdata;
     77                        },
    6578
    6679                        onComment : function( commentText )
    6780                        {
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy