Ticket #7932: 7932_4.patch

File 7932_4.patch, 5.8 KB (added by Garry Yao, 13 years ago)
  • _source/plugins/clipboard/plugin.js

     
    226226                // Wait a while and grab the pasted contents
    227227                window.setTimeout( function()
    228228                {
    229                         mode == 'text' && CKEDITOR.env.gecko && editor.focusGrabber.focus();
     229                        // Gecko need to move focus back from the textarea
     230                        // to blink the cursor. (#5684)
     231                        if ( mode == 'text' && CKEDITOR.env.gecko )
     232                                editor.document.getBody().focus();
     233
    230234                        pastebin.remove();
    231235                        editor.removeListener( 'selectionChange', cancel );
    232236
  • _source/plugins/editingblock/plugin.js

  • _source/plugins/wysiwygarea/plugin.js

     
    703703                                                        } );
    704704                                                }
    705705
    706                                                 // IE standard compliant in editing frame doesn't focus the editor when
    707                                                 // clicking outside actual content, manually apply the focus. (#1659)
    708                                                 if ( editable &&
    709                                                                 CKEDITOR.env.ie && domDocument.$.compatMode == 'CSS1Compat'
    710                                                                 || CKEDITOR.env.gecko
    711                                                                 || CKEDITOR.env.opera )
    712                                                 {
    713                                                         var htmlElement = domDocument.getDocumentElement();
    714                                                         htmlElement.on( 'mousedown', function( evt )
    715                                                         {
    716                                                                 // Setting focus directly on editor doesn't work, we
    717                                                                 // have to use here a temporary element to 'redirect'
    718                                                                 // the focus.
    719                                                                 if ( evt.data.getTarget().equals( htmlElement ) )
    720                                                                 {
    721                                                                         if ( CKEDITOR.env.gecko && CKEDITOR.env.version >= 10900 )
    722                                                                                 blinkCursor();
    723                                                                         focusGrabber.focus();
    724                                                                 }
    725                                                         } );
    726                                                 }
    727 
    728706                                                var focusTarget = CKEDITOR.env.ie ? iframe : domWindow;
    729707                                                focusTarget.on( 'blur', function()
    730708                                                        {
     
    12051183                                        });
    12061184                        }
    12071185
    1208                         // Create an invisible element to grab focus.
    1209                         if ( CKEDITOR.env.gecko || CKEDITOR.env.ie || CKEDITOR.env.opera )
    1210                         {
    1211                                 var focusGrabber;
    1212                                 editor.on( 'uiReady', function()
    1213                                 {
    1214                                         focusGrabber = editor.container.append( CKEDITOR.dom.element.createFromHtml(
    1215                                                 // Use 'span' instead of anything else to fly under the screen-reader radar. (#5049)
    1216                                                 '<span tabindex="-1" style="position:absolute;" role="presentation"></span>' ) );
    1217 
    1218                                         focusGrabber.on( 'focus', function()
    1219                                                 {
    1220                                                         editor.focus();
    1221                                                 } );
    1222 
    1223                                         editor.focusGrabber = focusGrabber;
    1224                                 } );
    1225                                 editor.on( 'destroy', function()
    1226                                 {
    1227                                         CKEDITOR.tools.removeFunction( contentDomReadyHandler );
    1228                                         focusGrabber.clearCustomData();
    1229                                         delete editor.focusGrabber;
    1230                                 } );
    1231                         }
    1232 
    12331186                        // Disable form elements editing mode provided by some browers. (#5746)
    12341187                        editor.on( 'insertElement', function ( evt )
    12351188                        {
  • _source/plugins/selection/plugin.js

     
    341341                                                        restoreEnabled = 1;
    342342                                                });
    343343
    344                                                 // In IE6/7 the blinking cursor appears, but contents are
    345                                                 // not editable. (#5634)
    346                                                 if ( CKEDITOR.env.ie && ( CKEDITOR.env.ie7Compat || CKEDITOR.env.version < 8 || CKEDITOR.env.quirks ) )
    347                                                 {
    348                                                         // The 'click' event is not fired when clicking the
    349                                                         // scrollbars, so we can use it to check whether
    350                                                         // the empty space following <body> has been clicked.
    351                                                         html.on( 'click', function( evt )
    352                                                         {
    353                                                                 if ( evt.data.getTarget().getName() == 'html' )
    354                                                                         editor.getSelection().getRanges()[ 0 ].select();
    355                                                         });
    356                                                 }
    357 
    358344                                                var scroll;
    359345                                                // IE fires the "selectionchange" event when clicking
    360346                                                // inside a selection. We don't want to capture that.
     
    399385                                                                saveSelection();
    400386                                                        });
    401387
     388                                                if ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat )
     389                                                {
     390                                                        html.$.unselectable = 'on';
     391                                                        // The 'click' event is not fired when clicking the
     392                                                        // scrollbars, so we can use it to check whether
     393                                                        // the empty space following <body> has been clicked.
     394                                                        html.on( 'click', function( evt )
     395                                                        {
     396                                                                if ( evt.data.getTarget().getName() != 'html' || editor.focusManager.hasFocus )
     397                                                                        return;
    402398
     399                                                                editor.focus();
     400
     401                                                                // Manually trigger range restore.
     402                                                                if ( savedRange )
     403                                                                        body.focus();
     404                                                                // Without a selection, the cursor blinks, but contents are not editable. (#5634)
     405                                                                else
     406                                                                        editor.getSelection().getRanges()[ 0 ].select();
     407                                                        });
     408                                                }
     409
     410
     411                                                if ( CKEDITOR.env.ie8 )
     412                                                {
     413                                                        // When content doc is in standards mode, IE doesn't focus the editor when
     414                                                        // clicking on outside body (on html element) content, manually apply the
     415                                                        // selection helps. (#1659, #7932)
     416                                                        html.on( 'mouseup', function( evt )
     417                                                        {
     418                                                                if ( evt.data.getTarget().getName() == 'html' )
     419                                                                {
     420                                                                        var sel = CKEDITOR.document.$.selection,
     421                                                                                range = sel.createRange();
     422                                                                        // The selection range is reported on host, but actually it should applies to the content doc.
     423                                                                        if ( sel.type != 'None' && range.parentElement().ownerDocument == doc.$ )
     424                                                                                range.select();
     425                                                                }
     426                                                        } );
     427                                                }
     428
    403429                                                // IE is the only to provide the "selectionchange"
    404430                                                // event.
    405431                                                doc.on( 'selectionchange', saveSelection );
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy