Ticket #5218: 5218.patch

File 5218.patch, 1.4 KB (added by Jonathon Sim, 14 years ago)

Fixed version of the patch

  • _source/plugins/clipboard/plugin.js

    diff -Naur ckeditor-trunk/_source/plugins/clipboard/plugin.js ckeditor-trunk-modified/_source/plugins/clipboard/plugin.js
    old new  
    292292                                editor.on( 'paste', function( evt )
    293293                                        {
    294294                                                var data = evt.data;
    295                                                 if ( data[ 'html' ] )
     295                                                if ( data[ 'html' ] ) {
     296                                                    if (CKEDITOR.env.gecko) {
     297                                                           //Gecko will modify the src attribute in images to be relative when you cut and paste: fix this if the image is pasted from within ckeditor
     298                                                                var fragment = CKEDITOR.htmlParser.fragment.fromHtml( data[ 'html' ] ),
     299                                                                writer = new CKEDITOR.htmlParser.basicWriter();
     300                                                                var htmlFilter = new CKEDITOR.htmlParser.filter();
     301                                                                htmlFilter.addRules( {
     302                                                                 elements :
     303                                                                 {
     304                                                                                img : function(element) {
     305                                                                                        if (element.attributes._cke_saved_src) element.attributes.src = element.attributes._cke_saved_src;
     306                                                                                        }
     307                                                                 }
     308                                                                } );
     309
     310                                                                fragment.writeHtml( writer, htmlFilter );
     311                                                                data[ 'html' ] = writer.getHtml( true );
     312                                                        }
    296313                                                        editor.insertHtml( data[ 'html' ] );
     314                                                }
    297315                                                else if ( data[ 'text' ] )
    298316                                                        editor.insertText( data[ 'text' ] );
    299317
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy