Ticket #4594: 4594_5.patch

File 4594_5.patch, 4.0 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/floatpanel/plugin.js

     
    191191                                                if ( rtl )
    192192                                                        left -= element.$.offsetWidth;
    193193
    194                                                 element.setStyles(
    195                                                         {
    196                                                                 left : left + 'px',
    197                                                                 visibility      : '',
    198                                                                 opacity : '1'   // FF3 is ignoring "visibility"
    199                                                         });
     194                                                var panelLoad = CKEDITOR.tools.bind( function ()
     195                                                {
     196                                                        if ( this.onShow )
     197                                                                this.onShow.call( this );
    200198
    201                                                 if ( block.autoSize )
    202                                                 {
    203                                                         function setHeight()
    204                                                         {
     199                                                        if ( block.autoSize )
     200                                                        {
    205201                                                                var target = element.getFirst();
    206202                                                                var height = block.element.$.scrollHeight;
    207203
     
    216212                                                                // Fix IE < 8 visibility.
    217213                                                                panel._.currentBlock.element.setStyle( 'display', 'none' ).removeStyle( 'display' );
    218214                                                        }
    219 
    220                                                         if ( panel.isLoaded )
    221                                                                 setHeight();
    222215                                                        else
    223                                                                 panel.onLoad = setHeight;
    224                                                 }
    225                                                 else
    226                                                         element.getFirst().removeStyle( 'height' );
     216                                                                element.getFirst().removeStyle( 'height' );
    227217
    228                                                 // Set the IFrame focus, so the blur event gets fired.
    229                                                 CKEDITOR.tools.setTimeout( function()
    230                                                         {
    231                                                                 if ( definition.voiceLabel )
    232                                                                 {
    233                                                                         if ( CKEDITOR.env.gecko )
    234                                                                         {
    235                                                                                 var container = iframe.getParent();
    236                                                                                 container.setAttribute( 'role', 'region' );
    237                                                                                 container.setAttribute( 'title', definition.voiceLabel );
    238                                                                                 iframe.setAttribute( 'role', 'region' );
    239                                                                                 iframe.setAttribute( 'title', ' ' );
    240                                                                         }
    241                                                                 }
    242                                                                
    243                                                                 iframe.$.contentWindow.focus();
     218                                                        var panelElement = panel.element,
     219                                                                panelWindow = panelElement.getWindow(),
     220                                                                windowScroll = panelWindow.getScrollPosition(),
     221                                                                viewportSize = panelWindow.getViewPaneSize(),
     222                                                                panelSize =
     223                                                                {
     224                                                                        'height' : panelElement.$.offsetHeight,
     225                                                                        'width' : panelElement.$.offsetWidth
     226                                                                };
     227
     228                                                        // If the menu is horizontal off, shift it toward
     229                                                        // the opposite language direction.
     230                                                        if ( rtl ? left < 0 : left + panelSize.width > viewportSize.width + windowScroll.x )
     231                                                                left += ( panelSize.width * ( rtl ? 1 : -1 ) );
     232
     233                                                        // Vertical off screen is simpler.
     234                                                        if( top + panelSize.height > viewportSize.height + windowScroll.y )
     235                                                                top -= panelSize.height;
     236
     237                                                        element.setStyles(
     238                                                                {
     239                                                                        top : top + 'px',
     240                                                                        left : left + 'px',
     241                                                                        visibility      : '',
     242                                                                        opacity : '1'   // FF3 is ignoring "visibility"
     243                                                                } );
     244
     245                                                        isShowing = false;
     246
     247                                                        // Set the panel frame focus, so the blur event gets fired.
     248                                                        CKEDITOR.tools.setTimeout( function()
     249                                                                {
     250                                                                        if ( definition.voiceLabel )
     251                                                                        {
     252                                                                                if ( CKEDITOR.env.gecko )
     253                                                                                {
     254                                                                                        var container = iframe.getParent();
     255                                                                                        container.setAttribute( 'role', 'region' );
     256                                                                                        container.setAttribute( 'title', definition.voiceLabel );
     257                                                                                        iframe.setAttribute( 'role', 'region' );
     258                                                                                        iframe.setAttribute( 'title', ' ' );
     259                                                                                }
     260                                                                        }
     261
     262                                                                        iframe.$.contentWindow.focus();
    244263
    245                                                                 // We need this get fired manually because of unfired focus() function.
    246                                                                 if ( CKEDITOR.env.ie && !CKEDITOR.env.quirks )
    247                                                                         this.allowBlur( true );
    248                                                         }, 0, this);
     264                                                                        // We need this get fired manually because of unfired focus() function.
     265                                                                        if ( CKEDITOR.env.ie && !CKEDITOR.env.quirks )
     266                                                                                this.allowBlur( true );
     267                                                                }, 0, this);
     268
     269                                                } , this );
     270
     271                                                panel.isLoaded ? panelLoad() : panel.onLoad = panelLoad;
    249272                                        }, 0, this);
    250273                                this.visible = 1;
    251274
    252                                 if ( this.onShow )
    253                                         this.onShow.call( this );
    254 
    255                                 isShowing = false;
    256275                        },
    257276
    258277                        hide : function()
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy