Ticket #4682: 4682_2.patch

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

     
    108108                                                // "onfocusin" is fired before "onfocus". It makes it
    109109                                                // possible to restore the selection before click
    110110                                                // events get executed.
    111                                                 body.on( 'focusin', function()
     111                                                body.on( 'focusin', function(evt)
    112112                                                        {
     113                                                                // If there are elements with layout they fire this event but
     114                                                                // it must be ignored to allow edit its contents #4682
     115                                                                if ( evt.data.$.srcElement.nodeName !== 'BODY' )
     116                                                                        return;
     117
    113118                                                                // If we have saved a range, restore it at this
    114119                                                                // point.
    115120                                                                if ( savedRange )
     
    134139                                                                saveSelection();
    135140                                                        });
    136141
    137                                                 body.on( 'beforedeactivate', function()
     142                                                body.on( 'beforedeactivate', function( evt )
    138143                                                        {
     144                                                                // Ignore this event if it's caused by focus swtich between
     145                                                                // internal editable control type elements, e.g. layouted paragraph. (#4682)
     146                                                                if ( evt.data.$.toElement )
     147                                                                        return;
     148
    139149                                                                // Disable selections from being saved.
    140150                                                                saveEnabled = false;
     151
     152                                                                // IE before version 8 will leave cursor blinking inside the document after
     153                                                                // editor blurred unless we clean up the selection. (#4716)
     154                                                                if ( CKEDITOR.env.ie && CKEDITOR.env.version < 8 )
     155                                                                {
     156                                                                        // IE stack overflows when we're doing so inside table. (#5114)
     157                                                                        // or an element with layout #4682
     158                                                                        var parent =
     159                                                                                savedRange
     160                                                                                && savedRange.parentElement
     161                                                                                && savedRange.parentElement();
     162
     163                                                                        if ( savedRange && !( parent && (parent.tagName.toLowerCase( ) in CKEDITOR.dtd.$tableContent || parent.currentStyle.hasLayout) ) )
     164                                                                                editor.document.$.selection.empty();
     165                                                                }
    141166                                                        });
    142167
    143168                                                // IE fires the "selectionchange" event when clicking
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy