Ticket #4594: 4594_3.patch

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

     
    195195                                                if ( rtl )
    196196                                                        left -= element.$.offsetWidth;
    197197
    198                                                 element.setStyles(
    199                                                         {
    200                                                                 left : left + 'px',
    201                                                                 visibility      : '',
    202                                                                 opacity : '1'   // FF3 is ignoring "visibility"
    203                                                         });
     198                                                var panelLoad = CKEDITOR.tools.bind( function ()
     199                                                {
     200                                                        if ( this.onShow )
     201                                                                this.onShow.call( this );
    204202
    205                                                 if ( block.autoSize )
    206                                                 {
    207                                                         function setHeight()
    208                                                         {
     203                                                        if ( block.autoSize )
     204                                                        {
    209205                                                                var target = element.getFirst();
    210206                                                                var height = block.element.$.scrollHeight;
    211207
     
    220216                                                                // Fix IE < 8 visibility.
    221217                                                                panel._.currentBlock.element.setStyle( 'display', 'none' ).removeStyle( 'display' );
    222218                                                        }
    223 
    224                                                         if ( panel.isLoaded )
    225                                                                 setHeight();
    226219                                                        else
    227                                                                 panel.onLoad = setHeight;
    228                                                 }
    229                                                 else
    230                                                         element.getFirst().removeStyle( 'height' );
     220                                                                element.getFirst().removeStyle( 'height' );
    231221
     222                                                        var panelElement = panel.element,
     223                                                                viewportSize = panelElement.getWindow().getViewPaneSize(),
     224                                                                panelSize =
     225                                                                {
     226                                                                        'height' : panelElement.$.offsetHeight,
     227                                                                        'width' : panelElement.$.offsetWidth
     228                                                                };
     229
     230                                                        // If the menu is horizontal off, shift it toward
     231                                                        // the opposite language direction.
     232                                                        if ( rtl ? left < 0 : left + panelSize.width > viewportSize.width )
     233                                                                left += ( panelSize.width * ( rtl ? 1 : -1 ) );
     234
     235                                                        // Vertical off screen is simpler.
     236                                                        if( top + panelSize.height > viewportSize.height )
     237                                                                top -= panelSize.height;
     238
     239                                                        element.setStyles(
     240                                                                {
     241                                                                        top : top + 'px',
     242                                                                        left : left + 'px',
     243                                                                        visibility      : '',
     244                                                                        opacity : '1'   // FF3 is ignoring "visibility"
     245                                                                } );
     246
     247                                                        isShowing = false;
     248                                                } , this );
     249
     250                                                panel.isLoaded ? panelLoad() : panel.onLoad = panelLoad;
    232251                                                // Set the IFrame focus, so the blur event gets fired.
    233252                                                CKEDITOR.tools.setTimeout( function()
    234253                                                        {
     
    255274                                        }, 0, this);
    256275                                this.visible = 1;
    257276
    258                                 if ( this.onShow )
    259                                         this.onShow.call( this );
    260 
    261                                 isShowing = false;
    262277                        },
    263278
    264279                        hide : function()
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy