Ticket #8324: 8324_2.patch

File 8324_2.patch, 1.3 KB (added by Garry Yao, 12 years ago)
  • _source/plugins/undo/plugin.js

     
    407407                                this.fireChange();
    408408                        return true;
    409409                },
     410
     411                restoreImage : function( image )
     412                {
     413                        // Bring editor focused to restore selection.
     414                        var editor = this.editor,
     415                                sel;
    410416
    411                 restoreImage : function( image )
    412                 {
    413                         this.editor.loadSnapshot( image.contents );
    414 
    415417                        if ( image.bookmarks )
    416                         {
    417                                 this.editor.focus();
    418                                 this.editor.getSelection().selectBookmarks( image.bookmarks );
     418                        {
     419                                editor.focus();
     420                                // Retrieve the selection beforehand. (#8324)
     421                                sel = editor.getSelection();
    419422                        }
    420                         else if ( CKEDITOR.env.ie )
    421                         {
    422                                 // IE BUG: If I don't set the selection to *somewhere* after setting
     423
     424                        this.editor.loadSnapshot( image.contents );
     425
     426                        if ( image.bookmarks )
     427                                sel.selectBookmarks( image.bookmarks );
     428                        else if ( CKEDITOR.env.ie )
     429                        {
     430                                // IE BUG: If I don't set the selection to *somewhere* after setting
    423431                                // document contents, then IE would create an empty paragraph at the bottom
    424432                                // the next time the document is modified.
    425433                                var $range = this.editor.document.getBody().$.createTextRange();
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy