Ticket #5782: 5782.patch

File 5782.patch, 1.5 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/wysiwygarea/plugin.js

     
    492492                                                domWindow.on( 'focus', function()
    493493                                                        {
    494494                                                                var doc = editor.document;
    495                                                                 if ( CKEDITOR.env.gecko || CKEDITOR.env.opera )
     495
     496                                                                if ( CKEDITOR.env.gecko )
     497                                                                        blinkCursor();
     498                                                                else if ( CKEDITOR.env.opera )
    496499                                                                        doc.getBody().focus();
    497500                                                                else if ( CKEDITOR.env.webkit )
    498501                                                                {
     
    821824                        // Switch on design mode for a short while and close it after then.
    822825                        function blinkCursor()
    823826                        {
    824                                 editor.document.$.designMode = 'on';
    825                                 setTimeout( function ()
    826                                 {
    827                                         editor.document.$.designMode = 'off';
    828                                 }, 50 );
     827                                CKEDITOR.tools.tryThese( function ()
     828                                {
     829                                        editor.document.$.designMode = 'on';
     830                                        setTimeout( function ()
     831                                        {
     832                                                editor.document.$.designMode = 'off';
     833                                                editor.document.getBody().focus();
     834                                        }, 50 );
     835                                }, function ()
     836                                {
     837                                        // Refresh 'contentEditable' when parent DOM
     838                                        // tree layout changes may break design mode. (#5782)
     839                                        editor.document.$.designMode = 'off';
     840                                        var body = editor.document.getBody();
     841                                        body.setAttribute( 'contentEditable', false );
     842                                        body.setAttribute( 'contentEditable', true );
     843                                        blinkCursor();
     844                                })
    829845                        }
    830846
    831847                        // Create an invisible element to grab focus.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy