Ticket #4594: 4594_4.patch

File 4594_4.patch, 2.6 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
     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                                                } , this );
     247
     248                                                panel.isLoaded ? panelLoad() : panel.onLoad = panelLoad;
    228249                                                // Set the IFrame focus, so the blur event gets fired.
    229250                                                CKEDITOR.tools.setTimeout( function()
    230251                                                        {
     
    249270                                        }, 0, this);
    250271                                this.visible = 1;
    251272
    252                                 if ( this.onShow )
    253                                         this.onShow.call( this );
    254 
    255                                 isShowing = false;
    256273                        },
    257274
    258275                        hide : function()
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy