Changeset 2386 for FCKeditor/trunk

Show
Ignore:
Timestamp:
2008-08-26 19:27:18 (5 months ago)
Author:
alfonsoml
Message:

Show correctly subpanels in IE7. #1982

Location:
FCKeditor/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor/trunk/editor/_source/classes/fckpanel.js

    r1950 r2386  
    131131} 
    132132 
     133// Workaround for IE7 problem. See #1982 
     134// Submenus are restricted to the size of its parent, so we increase it as needed. 
     135// Returns true if the panel has been repositioned 
     136FCKPanel.prototype.ResizeForSubpanel = function( panel, width, height ) 
     137{ 
     138        if ( !FCKBrowserInfo.IsIE7 ) 
     139                return false ; 
     140 
     141        if ( !this._Popup.isOpen ) 
     142        { 
     143                this.Subpanel = null ; 
     144                return false ; 
     145        } 
     146 
     147        // If we are resetting the extra space 
     148        if ( width == 0 && height == 0 ) 
     149        { 
     150                // Another subpanel is being shown, so we must not shrink back 
     151                if (this.Subpanel !== panel) 
     152                        return false ; 
     153 
     154                // Reset values.  
     155                // We leave the IncreasedY untouched to avoid vertical movement of the  
     156                // menu if the submenu is higher than the main menu. 
     157                this.Subpanel = null ; 
     158                this.IncreasedX = 0 ; 
     159        } 
     160        else 
     161        { 
     162                this.Subpanel = panel ; 
     163                // If the panel has already been increased enough, get out 
     164                if (( this.IncreasedX >= width) && (this.IncreasedY >= height)) 
     165                        return false ; 
     166 
     167                this.IncreasedX = Math.max(this.IncreasedX, width) ; 
     168                this.IncreasedY = Math.max(this.IncreasedY, height) ; 
     169        } 
     170 
     171        var x = this.ShowRect.x ; 
     172        var w = this.IncreasedX ; 
     173        if ( this.IsRTL ) 
     174                x  = x - w ; 
     175         
     176        // Horizontally increase as needed (sum of widths).  
     177        // Vertically, use only the maximum of this menu or the submenu 
     178        this._Popup.show( x, this.ShowRect.y, this.ShowRect.w + w, Math.max(this.ShowRect.h, this.IncreasedY) ) ; 
     179 
     180        return this.IsRTL ; 
     181} 
     182 
    133183FCKPanel.prototype.Show = function( x, y, relElement, width, height ) 
    134184{ 
     
    153203                iMainWidth = eMainNode.offsetWidth ; 
    154204 
     205                if ( FCKBrowserInfo.IsIE7 ) 
     206                { 
     207                        if (this.ParentPanel && this.ParentPanel.ResizeForSubpanel(this, iMainWidth, eMainNode.offsetHeight) ) 
     208                        { 
     209                                // As the parent has moved, allow the browser to update its internal data, so the new position is correct. 
     210                                FCKTools.RunFunction( this.Show, this, [x, y, relElement] ) ; 
     211                                return ; 
     212                        } 
     213                } 
     214 
    155215                if ( this.IsRTL ) 
    156216                { 
     
    159219                        else if ( relElement ) 
    160220                                x  = ( x * -1 ) + relElement.offsetWidth - iMainWidth ; 
     221                } 
     222 
     223                if ( FCKBrowserInfo.IsIE7 ) 
     224                { 
     225                        // Store the values that will be used by the ResizeForSubpanel function 
     226                        this.ShowRect = {x:x, y:y, w:iMainWidth, h:eMainNode.offsetHeight} ; 
     227                        this.IncreasedX = 0 ; 
     228                        this.IncreasedY = 0 ; 
    161229                } 
    162230 
     
    376444                this._Timer = null ; 
    377445 
     446                if (this._Popup && this.ParentPanel && !forceHide) 
     447                        this.ParentPanel.ResizeForSubpanel(this, 0, 0) 
     448 
    378449                FCKTools.RunFunction( this.OnHide, this ) ; 
    379450        } 
  • FCKeditor/trunk/_whatsnew.html

    r2375 r2386  
    5959                        placed inside a container with dimensions or floating it wasn't possible to edit its  
    6060                        properties from the toolbar or context menu.</li> 
     61                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1982">#1982</a>] Submenus in IE7 
     62                        now are shown properly.</li> 
    6163        </ul> 
    6264        <p>