Ticket #5461: 5461_3.patch

File 5461_3.patch, 2.5 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/clipboard/dialogs/paste.js

     
    1111        function onPasteFrameLoad( win )
    1212        {
    1313                var doc =  new CKEDITOR.dom.document( win.document ),
    14                         $ = doc.$;
     14                        docElement = doc.$,
     15                        selection, bookmarks;
    1516
    1617                doc.getById( "cke_actscrpt" ).remove();
    1718
    1819                CKEDITOR.env.ie ?
    19                         $.body.contentEditable = "true" :
    20                         $.designMode = "on";
     20                        docElement.body.contentEditable = "true" :
     21                        docElement.designMode = "on";
    2122
    22                 CKEDITOR.env.ie && doc.getWindow().on( 'blur', function()
     23                // IE before version 8 will leave cursor blinking inside the document after
     24                // editor blurred unless we clean up the selection. (#4716)
     25                if ( CKEDITOR.env.ie && CKEDITOR.env.version < 8 )
    2326                {
    24                          $.body.contentEditable = "false";
    25                 } );
     27                        doc.getWindow().on( 'blur', function()
     28                        {
     29                                docElement.selection.empty();
     30                        } );
     31                }
    2632
    2733                doc.on( "keydown", function( e )
    2834                {
     
    108114                        container.setHtml( '' );
    109115                        container.append( iframe );
    110116
     117                        // IE need a redirect on focus to make
     118                        // the cursor blinking inside iframe. (#5461)
     119                        if ( CKEDITOR.env.ie )
     120                        {
     121                                var focusGrabber = CKEDITOR.dom.element.createFromHtml( '<span tabindex="-1" style="position:absolute;" role="presentation"></span>' );
     122                                focusGrabber.on( 'focus', function()
     123                                {
     124                                        iframe.$.contentWindow.focus();
     125                                });
     126                                container.append( focusGrabber );
     127
     128                                // Override focus handler on field.
     129                                field.focus = function()
     130                                {
     131                                        focusGrabber.focus();
     132                                        this.fire( 'focus' );
     133                                };
     134                        }
     135
    111136                        field.getInputElement = function(){ return iframe; };
    112137
    113138                        // Force container to scale in IE.
     
    165190                                                html : '',
    166191                                                focus : function()
    167192                                                {
    168                                                         var win = this.getInputElement().$.contentWindow,
    169                                                                  body = win && win.document.body;
     193                                                        var win = this.getInputElement().$.contentWindow;
    170194
    171195                                                        // #3291 : JAWS needs the 500ms delay to detect that the editor iframe
    172196                                                        // iframe is no longer editable. So that it will put the focus into the
    173197                                                        // Paste from Word dialog's editable area instead.
    174198                                                        setTimeout( function()
    175199                                                        {
    176                                                                 // Reactivate design mode for IE to make the cursor blinking.
    177                                                                 CKEDITOR.env.ie && body && ( body.contentEditable = "true" );
    178200                                                                win.focus();
    179201                                                        }, 500 );
    180202                                                }
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy