Ticket #5778: 5778.patch

File 5778.patch, 1.4 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/selection/plugin.js

     
    172172                                                        });
    173173                                                }
    174174
     175                                                var scroll;
    175176                                                // IE fires the "selectionchange" event when clicking
    176177                                                // inside a selection. We don't want to capture that.
    177                                                 body.on( 'mousedown', disableSave );
     178                                                body.on( 'mousedown', function( evt )
     179                                                {
     180                                                        // IE scrolls document to top on right mousedown
     181                                                        // when editor has no focus, remember this scroll
     182                                                        // position and revert it before context menu opens. (#5778)
     183                                                        if ( evt.data.$.button == 2 )
     184                                                        {
     185                                                                var sel = editor.document.$.selection;
     186                                                                if ( sel.type == 'None' )
     187                                                                        scroll = editor.window.getScrollPosition();
     188                                                        }
     189
     190                                                        disableSave();
     191                                                });
    178192                                                body.on( 'mouseup',
    179                                                         function()
     193                                                        function( evt )
    180194                                                        {
     195                                                                // Restore recorded scroll position when needed on right mouseup.
     196                                                                if ( evt.data.$.button == 2 && scroll )
     197                                                                {
     198                                                                        editor.document.$.documentElement.scrollLeft = scroll.x;
     199                                                                        editor.document.$.documentElement.scrollTop = scroll.y;
     200                                                                }
     201
     202                                                                scroll = null;
    181203                                                                saveEnabled = true;
    182204                                                                setTimeout( function()
    183205                                                                        {
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy