Ticket #6192: 6192.patch

File 6192.patch, 1.2 KB (added by Tobiasz Cudnik, 14 years ago)
  • _source/plugins/wysiwygarea/plugin.js

     
    616616                                                                editor.focusManager.blur();
    617617                                                        });
    618618
     619                                                var wasFocused = 0;
     620
    619621                                                domWindow.on( 'focus', function()
    620622                                                        {
    621623                                                                var doc = editor.document;
     
    624626                                                                        blinkCursor();
    625627                                                                else if ( CKEDITOR.env.opera )
    626628                                                                        doc.getBody().focus();
     629                                                                else if ( CKEDITOR.env.webkit )
     630                                                                {
     631                                                                        if ( !wasFocused )
     632                                                                        {
     633                                                                                editor.document.getDocumentElement().focus();
     634                                                                                wasFocused = 1;
     635                                                                        }
     636                                                                        // Webkit will fail to focus the contenteditable body if no range is set.
     637                                                                        if ( editor.getSelection().getRanges().length === 0 )
     638                                                                        {
     639                                                                                var selection, range;
     640                                                                                range = doc.$.createRange();
     641                                                                                range.selectNodeContents( $( doc.$.body ).children()[ 0 ] );
     642                                                                                range.collapse( true );
     643                                                                                selection = editor.window.$.getSelection();
     644                                                                                selection.removeAllRanges();
     645                                                                                selection.addRange( range );
     646                                                                        }
     647                                                                }
    627648
    628649                                                                editor.focusManager.focus();
    629650                                                        });
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy