Ticket #4542: 4542.patch

File 4542.patch, 2.8 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/dialog/plugin.js

     
    278278                                focusList[ currentIndex ].select();
    279279                }
    280280
     281                var processed;
     282
    281283                function focusKeydownHandler( evt )
    282284                {
    283285                        // If I'm not the top dialog, ignore.
    284286                        if ( me != CKEDITOR.dialog._.currentTop )
    285287                                return;
    286288
    287                         var keystroke = evt.data.getKeystroke(),
    288                                 processed = false;
     289                        var keystroke = evt.data.getKeystroke();
     290
     291                        processed = 0;
    289292                        if ( keystroke == 9 || keystroke == CKEDITOR.SHIFT + 9 )
    290293                        {
    291294                                var shiftPressed = ( keystroke == CKEDITOR.SHIFT + 9 );
     
    304307                                        changeFocus( !shiftPressed );
    305308                                }
    306309
    307                                 processed = true;
     310                                processed = 1;
    308311                        }
    309312                        else if ( keystroke == CKEDITOR.ALT + 121 && !me._.tabBarMode )
    310313                        {
    311314                                // Alt-F10 puts focus into the current tab item in the tab bar.
    312315                                me._.tabBarMode = true;
    313316                                me._.tabs[ me._.currentTabId ][ 0 ].focus();
    314                                 processed = true;
     317                                processed = 1;
    315318                        }
    316319                        else if ( ( keystroke == 37 || keystroke == 39 ) && me._.tabBarMode )
    317320                        {
     
    319322                                nextId = ( keystroke == 37 ? getPreviousVisibleTab.call( me ) : getNextVisibleTab.call( me ) );
    320323                                me.selectPage( nextId );
    321324                                me._.tabs[ nextId ][ 0 ].focus();
    322                                 processed = true;
     325                                processed = 1;
    323326                        }
    324327
    325328                        if ( processed )
     
    329332                        }
    330333                }
    331334
     335                function focusKeyPressHandler( evt )
     336                {
     337                        processed && evt.data.preventDefault();
     338                }
     339
    332340                // Add the dialog keyboard handlers.
    333341                this.on( 'show', function()
    334342                        {
    335343                                CKEDITOR.document.on( 'keydown', focusKeydownHandler, this, null, 0 );
     344                                // Some browsers instead, don't cancel key events in the keydown, but in the
     345                                // keypress. So we must do a longer trip in those cases. (#4531)
     346                                if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) )
     347                                        CKEDITOR.document.on( 'keypress', focusKeyPressHandler, this );
    336348
    337349                                if ( CKEDITOR.env.ie6Compat )
    338350                                {
     
    24482460                 */
    24492461                isVisible : function()
    24502462                {
    2451                         return !!this.getInputElement().$.offsetHeight;
     2463                        var element = this.getInputElement(),
     2464                                elementWindow = element.getWindow(),
     2465                                elementFrame,
     2466                                isVisible = !!element.$.offsetHeight;
     2467
     2468                        // Webkit and Opera report non-zero offsetHeight despite that
     2469                        // element is inside an invisible iframe. (#4542)
     2470                        if( isVisible && ( CKEDITOR.env.webkit || CKEDITOR.env.opera )
     2471                                && !elementWindow.equals( CKEDITOR.document.getWindow() )
     2472                                && ( elementFrame = elementWindow.$.frameElement ) )
     2473                                isVisible = !!elementFrame.offsetHeight;
     2474
     2475                        return isVisible;
    24522476                },
    24532477
    24542478                /**
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy