Ticket #4709: 4709_2.patch

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

     
    9292                {
    9393                        editor.on( 'contentDom', function()
    9494                                {
    95                                         var doc = editor.document;
     95                                        var doc = editor.document,
     96                                                body = doc.getBody();
    9697
    9798                                        if ( CKEDITOR.env.ie )
    9899                                        {
     
    107108                                                // "onfocusin" is fired before "onfocus". It makes it
    108109                                                // possible to restore the selection before click
    109110                                                // events get executed.
    110                                                 doc.on( 'focusin', function()
     111                                                body.on( 'focusin', function()
    111112                                                        {
    112113                                                                // If we have saved a range, restore it at this
    113114                                                                // point.
     
    133134                                                                saveSelection();
    134135                                                        });
    135136
    136                                                 // Check document selection before 'blur' fired, this
    137                                                 // will prevent us from breaking text selection somewhere
    138                                                 // else on the host page.(#3909)
    139                                                 editor.document.on( 'beforedeactivate', function()
     137                                                body.on( 'beforedeactivate', function()
    140138                                                        {
    141139                                                                // Disable selections from being saved.
    142140                                                                saveEnabled = false;
    143 
    144                                                                 // IE may leave the selection still inside the
    145                                                                 // document. Let's force it to be removed.
    146                                                                 // TODO: The following has effect for
    147                                                                 // collapsed selections.
    148                                                                 editor.document.$.execCommand( 'Unselect' );
    149141                                                        });
    150142
    151143                                                // IE fires the "selectionchange" event when clicking
    152144                                                // inside a selection. We don't want to capture that.
    153                                                 doc.on( 'mousedown', disableSave );
    154                                                 doc.on( 'mouseup',
     145                                                body.on( 'mousedown', disableSave );
     146                                                body.on( 'mouseup',
    155147                                                        function( evt )
    156148                                                        {
    157149                                                                // IE context-menu event in table cells collapse
     
    170162                                                                        0 );
    171163                                                        });
    172164
    173                                                 doc.on( 'keydown', disableSave );
    174                                                 doc.on( 'keyup',
     165                                                body.on( 'keydown', disableSave );
     166                                                body.on( 'keyup',
    175167                                                        function()
    176168                                                        {
    177169                                                                saveEnabled = true;
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy