Ticket #1982: 1982_1.patch

File 1982_1.patch, 3.7 KB (added by Alfonso Martínez de Lizarrondo, 15 years ago)

Patch including RTL handling.

  • _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.
     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{
    135185        var iMainWidth ;
     
    152202
    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                {
    157217                        if ( this.IsContextMenu )
     
    160220                                x  = ( x * -1 ) + relElement.offsetWidth - iMainWidth ;
    161221                }
    162222
     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 ;
     229                }
     230
    163231                // Second call: Show the Popup at the specified location, with the correct size.
    164232                this._Popup.show( x, y, iMainWidth, eMainNode.offsetHeight, relElement ) ;
    165233
     
    375443                window.clearInterval( this._Timer ) ;
    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        }
    380451}
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy