Ticket #3222: 3222_2.patch

File 3222_2.patch, 2.7 KB (added by Artur Formella, 15 years ago)
  • _source/core/dom/domobject.js

     
    8585                                var listener = nativeListeners[ eventName ] = getNativeListener( this, eventName );
    8686
    8787                                if ( this.$.addEventListener )
    88                                         this.$.addEventListener( eventName, listener, false );
     88                                        this.$.addEventListener( eventName, listener, !!CKEDITOR.event.useCapture );
    8989                                else if ( this.$.attachEvent )
    9090                                        this.$.attachEvent( 'on' + eventName, listener );
    9191                        }
  • _source/plugins/floatpanel/plugin.js

     
    102102                                var panel = this._.panel,
    103103                                        block = panel.showBlock( name );
    104104
     105                                this.allowBlur( false );
    105106                                isShowing = true;
    106107
    107108                                var element = this.element,
     
    134135                                        // Non IE prefer the event into a window object.
    135136                                        var focused = CKEDITOR.env.ie ? iframe : new CKEDITOR.dom.window( iframe.$.contentWindow );
    136137
    137                                         focused.on( 'blur', function()
     138                                        // With addEventListener compatible browsers, we must
     139                                        // useCapture when registering the focus/blur events to
     140                                        // guarantee they will be firing in all situations. (#3068, #3222 )
     141                                        CKEDITOR.event.useCapture = true;
     142
     143                                        focused.on( 'blur', function( ev )
    138144                                                {
     145                                                        if ( CKEDITOR.env.ie && !this.allowBlur() )
     146                                                                return;
     147
     148                                                        // As we are using capture to register the listener,
     149                                                        // the blur event may get fired even when focusing
     150                                                        // inside the window itself, so we must ensure the
     151                                                        // target is out of it.
     152                                                        var target = ev.data.getTarget(),
     153                                                                targetWindow = target.getWindow && target.getWindow();
     154
     155                                                        if ( targetWindow && targetWindow.equals( focused ) )
     156                                                                return;
     157
    139158                                                        if ( !this._.activeChild && !isShowing )
    140159                                                                this.hide();
    141160                                                },
     
    145164                                                {
    146165                                                        this._.focused = true;
    147166                                                        this.hideChild();
     167                                                        this.allowBlur( true );
    148168                                                },
    149169                                                this );
    150170
     171                                        CKEDITOR.event.useCapture = false;
     172
    151173                                        this._.blurSet = 1;
    152174                                }
    153175
     
    239261                                }
    240262                        },
    241263
     264                        allowBlur : function( allow )   // Prevent editor from hiding the panel. #3222.
     265                        {
     266                                var panel = this._.panel;
     267                                if ( allow != undefined )
     268                                        panel.allowBlur = allow;
     269
     270                                return panel.allowBlur;
     271                        },
     272
    242273                        showAsChild : function( panel, blockName, offsetParent, corner, offsetX, offsetY )
    243274                        {
    244275                                this.hideChild();
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy