Changeset 2200

Show
Ignore:
Timestamp:
2008-07-09 07:17:53 (5 months ago)
Author:
martinkou
Message:

Improved div container detection logic to correctly account for multi-level selections.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor/branches/features/div_container/editor/_source/internals/fckdomtools.js

    r2199 r2200  
    10411041                do 
    10421042                { 
    1043                         if ( currentNode.nodeName.IEquals( 'div' ) && currentNode.firstChild && 
    1044                                         FCKListsLib.BlockElements[ currentNode.firstChild.nodeName.toLowerCase() ] ) 
    1045                         { 
     1043                        var child = currentNode.firstChild ; 
     1044                        while ( child && child.nodeType != 1 ) 
     1045                                child = child.nextSibling ; 
     1046 
     1047                        if ( currentNode.nodeName.IEquals( 'div' ) && child && 
     1048                                        FCKListsLib.BlockElements[ child.nodeName.toLowerCase() ] ) 
     1049                        { 
     1050                                // This is a block limit node. 
    10461051                                currentBlocks.push( currentNode ) ; 
    10471052                                if ( currentNode.parentNode.nodeName.IEquals( 'div' ) ) 
     
    10491054                                                        '_fckignorethisnode', true ) ; 
    10501055                        } 
     1056                        else 
     1057                        { 
     1058                                // This is not a block limit node. 
     1059                                FCKDomTools.SetElementMarker( elementMarkers, currentNode.parentNode, 
     1060                                                '_fckincludethisnode', true ) ; 
     1061                        } 
    10511062                } 
    10521063                while ( ( currentNode = FCKDomTools.GetNextSourceElement( currentNode ) ) && currentNode != endNode 
     
    10551066                for ( var i = currentBlocks.length - 1 ; i >= 0 ; i-- ) 
    10561067                { 
    1057                         if ( currentBlocks[i]['_fckignorethisnode'] ) 
     1068                        if ( currentBlocks[i]['_fckignorethisnode'] && !currentBlocks[i]['_fckincludethisnode'] ) 
    10581069                                currentBlocks.splice( i, 1 ) ; 
    10591070                }