Ticket #5536: 5536.patch

File 5536.patch, 1.3 KB (added by Tobiasz Cudnik, 14 years ago)
  • _source/plugins/wysiwygarea/plugin.js

     
    3636                        if ( checkReadOnly( selection ) )
    3737                                return;
    3838
    39                         var data = evt.data;
     39                        var range,
     40                                data = evt.data;
    4041                        this.fire( 'saveSnapshot' );
    4142
    4243                        if ( this.dataProcessor )
     
    6061                                        // (#6005), we need to make some checks and eventually
    6162                                        // delete the selection first.
    6263
    63                                         var range = selection.getRanges()[0],
     64                                        range = selection.getRanges()[0],
    6465                                                endContainer = range && range.endContainer;
    6566
    6667                                        if ( endContainer &&
     
    8283                                if ( selIsLocked )
    8384                                        this.getSelection().lock();
    8485                        }
     86                        // Firefox breaks format when pasting using execCommand-inserthtml (#5536).
     87                        else if ( CKEDITOR.env.gecko )
     88                        {
     89                                range = this.document.getSelection().getRanges()[ 0 ];
     90                                // Clean selection.
     91                                range.extractContents();
     92                                var target = range.createBookmark().startNode;
     93                                var container = new CKEDITOR.dom.element( 'div', this.document );
     94                                container.setHtml( data );
     95
     96                                while( container.getChildCount() )
     97                                        target.insertBeforeMe( container.getChild( 0 ) );
     98
     99                                target.remove();
     100                        }
    85101                        else
    86102                                this.document.$.execCommand( 'inserthtml', false, data );
    87103
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy