Ticket #2948: 2948.patch

File 2948.patch, 1.8 KB (added by Martin Kou, 15 years ago)
  • _source/plugins/wysiwygarea/plugin.js

     
    6666                if ( this.mode == 'wysiwyg' )
    6767                {
    6868                        var $doc = this.document.$;
     69                        var data = protectHtml( evt.data );
    6970
    7071                        if ( CKEDITOR.env.ie )
    71                                 $doc.selection.createRange().pasteHTML( evt.data );
     72                                $doc.selection.createRange().pasteHTML( data );
    7273                        else
    73                                 $doc.execCommand( 'inserthtml', false, evt.data );
     74                                $doc.execCommand( 'inserthtml', false, data );
    7475                }
    7576        };
    7677
     
    8182                return html.replace( protectCkeTagRegex, '$1cke:$2' );
    8283        };
    8384        // ### protectCkeTags - END
     85       
     86        function protectHtml( html )
     87        {
     88                // Prevent event attributes (like "onclick") to
     89                // execute while editing.
     90                if ( CKEDITOR.env.ie || CKEDITOR.env.webkit )
     91                        html = protectEvents( html );
    8492
     93                // Protect src or href attributes.
     94                html = protectUrls( html );
     95
     96                // Protect cke prefixed tags.
     97                html = protectCkeTags( html );
     98
     99                return html;
     100        }
     101
    85102        var onInsertElement = function( evt )
    86103        {
    87104                if ( this.mode == 'wysiwyg' )
     
    299316                                                                if ( CKEDITOR.env.ie )
    300317                                                                        data = data.replace( invalidSelfCloseTagsRegex, '$1></$2>' );
    301318
    302                                                                 // Prevent event attributes (like "onclick") to
    303                                                                 // execute while editing.
    304                                                                 if ( CKEDITOR.env.ie || CKEDITOR.env.webkit )
    305                                                                         data = protectEvents( data );
    306 
    307                                                                 // Protect src or href attributes.
    308                                                                 data = protectUrls( data );
    309 
    310                                                                 // Protect cke prefixed tags.
    311                                                                 data = protectCkeTags( data );
    312 
     319                                                                data = protectHtml( data );
    313320                                                                data =
    314321                                                                        editor.config.docType +
    315322                                                                        '<html dir="' + editor.config.contentsLangDirection + '">' +
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy