Ticket #4519: 4519.patch

File 4519.patch, 1.3 KB (added by Garry Yao, 15 years ago)
  • _source/plugins/maximize/plugin.js

     
    120120                                                // Save current selection and scroll position in editing area.
    121121                                                if ( editor.mode == 'wysiwyg' )
    122122                                                {
    123                                                         savedSelection = editor.getSelection().getRanges();
     123                                                        var selection = editor.getSelection();
     124                                                        if( selection )
     125                                                                savedSelection = selection.getRanges();
    124126                                                        savedScroll = mainWindow.getScrollPosition();
    125127                                                }
    126128                                                else
     
    235237                                                // Restore selection and scroll position in editing area.
    236238                                                if ( editor.mode == 'wysiwyg' )
    237239                                                {
    238                                                         editor.getSelection().selectRanges( savedSelection );
    239 
    240                                                         var element = editor.getSelection().getStartElement();
    241                                                         if ( element )
    242                                                                 element.scrollIntoView( true );
     240                                                        if ( savedSelection )
     241                                                        {
     242                                                                editor.getSelection().selectRanges( savedSelection );
     243                                                                var element = editor.getSelection().getStartElement();
     244                                                                if ( element )
     245                                                                        element.scrollIntoView( true );
     246                                                        }
    243247                                                        else
    244248                                                                mainWindow.$.scrollTo( savedScroll.x, savedScroll.y );
    245249                                                }
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy