Ticket #4795: 4795.patch

File 4795.patch, 1.7 KB (added by pomu0325, 14 years ago)

workaroung patch for IE8Compat mode

  • plugin.js

     
    103103                                                // than firing the selection change event.
    104104
    105105                                                var savedRange,
     106                                                        savedRange2,
    106107                                                        saveEnabled;
    107108
    108109                                                // "onfocusin" is fired before "onfocus". It makes it
     
    161162                                                                        0 );
    162163                                                        });
    163164
    164                                                 body.on( 'keydown', disableSave );
     165                                                body.on( 'keydown', function()
     166                                                        {
     167                                                                if ( CKEDITOR.env.ie8Compat && editor.getSelection().getType() == CKEDITOR.SELECTION_ELEMENT )
     168                                                                {
     169                                                                        savedRange2 = editor.document.$.body.createTextRange();
     170                                                                        var sel = editor.document.$.selection.createRange();
     171                                                                        var nxt = sel.commonParentElement().nextSibling;
     172                                                                        while ( nxt && nxt.nodeType != 1 )
     173                                                                                nxt = nxt.nextSibling;  // skip #text
     174
     175                                                                        if ( nxt )
     176                                                                        {
     177                                                                                savedRange2.moveToElementText( nxt );
     178                                                                                savedRange2.move( 'character', 0 );
     179                                                                        }
     180                                                                        else
     181                                                                        {
     182                                                                                savedRange2.move( 'textedit', 1 );
     183                                                                        }
     184                                                                }
     185                                                                disableSave();
     186                                                        });
     187
    165188                                                body.on( 'keyup',
    166189                                                        function()
    167190                                                        {
     
    206229                                                                                return;
    207230                                                                        }
    208231                                                                }
     232                                                                try
     233                                                                {
     234                                                                        savedRange = sel && sel.createRange();
     235                                                                }
     236                                                                catch (e)
     237                                                                {
     238                                                                        if ( savedRange2 )
     239                                                                        {
     240                                                                                savedRange2.select();
     241                                                                                savedRange2 = null;
     242                                                                        }
     243                                                                }
    209244
    210                                                                 savedRange = sel && sel.createRange();
    211 
    212245                                                                checkSelectionChangeTimeout.call( editor );
    213246                                                        }
    214247                                                }
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy