Ticket #1982: 1982.patch

File 1982.patch, 3.2 KB (added by Alfonso Martínez de Lizarrondo, 16 years ago)

Proposed patch

  • _whatsnew.html

     
    5050                        character inside text wasn't encoded in Opera and Safari.</li>
    5151                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2467">#2467</a>] Fixed JavaScript
    5252                        error with the fit window command in source mode.</li>
     53                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1982">#1982</a>] Submenus in IE7
     54                        now are shown properly.</li>
    5355        </ul>
    5456        <p>
    5557                <a href="_whatsnew_history.html">See previous versions history</a></p>
  • editor/_source/classes/fckpanel.js

     
    130130                this._Popup.show( x, y, 0, 0, relElement ) ;
    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.
     135FCKPanel.prototype.ResizeForSubpanel = function( panel, width, height )
     136{
     137        if ( !FCKBrowserInfo.IsIE7 )
     138                return ;
     139
     140        if ( !this._Popup.isOpen )
     141        {
     142                this.Subpanel = null ;
     143                return ;
     144        }
     145
     146        // If we are resetting the extra space
     147        if ( width == 0 && height == 0 )
     148        {
     149                // Another subpanel is being shown, so we must not shrink back
     150                if (this.Subpanel !== panel)
     151                        return ;
     152
     153                // Reset values.
     154                // We leave the IncreasedY untouched to avoid vertical movement of the
     155                // menu if the submenu is higher than the main menu.
     156                this.Subpanel = null ;
     157                this.IncreasedX = 0 ;
     158        }
     159        else
     160        {
     161                this.Subpanel = panel ;
     162                // If the panel has already been increased enough, get out
     163                if (( this.IncreasedX >= width) && (this.IncreasedY >= height))
     164                        return ;
     165
     166                this.IncreasedX = Math.max(this.IncreasedX, width) ;
     167                this.IncreasedY = Math.max(this.IncreasedY, height) ;
     168        }
     169
     170        // Horizontally increase as needed (sum of widths).
     171        // Vertically, use only the maximum of this menu or the submenu
     172        this._Popup.show( this.ShowRect.x, this.ShowRect.y, this.ShowRect.w + this.IncreasedX, Math.max(this.ShowRect.h, this.IncreasedY) ) ;
     173}
     174
    133175FCKPanel.prototype.Show = function( x, y, relElement, width, height )
    134176{
    135177        var iMainWidth ;
     
    160202                                x  = ( x * -1 ) + relElement.offsetWidth - iMainWidth ;
    161203                }
    162204
     205                if ( FCKBrowserInfo.IsIE7 )
     206                {
     207                        if (this.ParentPanel)
     208                                this.ParentPanel.ResizeForSubpanel(this, iMainWidth, eMainNode.offsetHeight)
     209                       
     210                        // Store the values that will be used by the ResizeForSubpanel function
     211                        this.ShowRect = {x:x, y:y, w:iMainWidth, h:eMainNode.offsetHeight} ;
     212                        this.IncreasedX = 0 ;
     213                        this.IncreasedY = 0 ;
     214                }
     215
    163216                // Second call: Show the Popup at the specified location, with the correct size.
    164217                this._Popup.show( x, y, iMainWidth, eMainNode.offsetHeight, relElement ) ;
    165218
     
    375428                window.clearInterval( this._Timer ) ;
    376429                this._Timer = null ;
    377430
     431                if (this._Popup && this.ParentPanel && !forceHide)
     432                        this.ParentPanel.ResizeForSubpanel(this, 0, 0)
     433
    378434                FCKTools.RunFunction( this.OnHide, this ) ;
    379435        }
    380436}
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy