Changeset 1089

Show
Ignore:
Timestamp:
2007-11-19 08:59:39 (9 months ago)
Author:
martinkou
Message:

Fixed #1514 : Fixed the issue where floating panels are positioned incorrectly when FCKeditor is not static positioned.

Location:
FCKeditor/trunk/editor/_source
Files:
2 modified

Legend:

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

    r922 r1089  
    191191                iMainWidth = eMainNode.offsetWidth || eMainNode.firstChild.offsetWidth ; 
    192192 
     193                // Base the popup coordinates upon the coordinates of relElement. 
    193194                var oPos = FCKTools.GetElementPosition( 
    194195                        relElement.nodeType == 9 ? 
     
    197198                        this._Window ) ; 
    198199 
     200                // Minus the offsets provided by any positioned parent element of the panel iframe. 
     201                var positionedAncestor = FCKDomTools.GetPositionedAncestor( FCKTools.GetElementWindow( this._IFrame ), this._IFrame.parentNode ) ; 
     202                if ( positionedAncestor ) 
     203                { 
     204                        // GetElementPosition() does not work here for some reason... so I'm using GetDocumentPosition() here instead. 
     205                        var nPos = FCKTools.GetDocumentPosition( FCKTools.GetElementWindow( positionedAncestor ), positionedAncestor ) ; 
     206                        oPos.X -= nPos.x ; 
     207                        oPos.Y -= nPos.y ; 
     208                } 
     209 
    199210                if ( this.IsRTL && !this.IsContextMenu ) 
    200211                        x = ( x * -1 ) ; 
  • FCKeditor/trunk/editor/_source/internals/fckdomtools.js

    r1086 r1089  
    920920                for ( var styleName in styleDict ) 
    921921                        style[ styleName ] = styleDict[ styleName ] ; 
     922        }, 
     923 
     924        GetCurrentElementStyle : function( w, element, attrName ) 
     925        { 
     926                if ( FCKBrowserInfo.IsIE ) 
     927                        return element.currentStyle[attrName] ; 
     928                else 
     929                        return w.getComputedStyle( element, '' )[attrName] ; 
     930        }, 
     931 
     932        GetPositionedAncestor : function( w, element ) 
     933        { 
     934                var currentElement = element ; 
     935                while ( currentElement != currentElement.ownerDocument.documentElement ) 
     936                { 
     937                        if ( this.GetCurrentElementStyle( w, currentElement, 'position' ) != 'static' ) 
     938                                return currentElement ; 
     939                        currentElement = currentElement.parentNode ; 
     940                } 
     941                return null ; 
    922942        } 
    923943} ;