Changeset 1139

Show
Ignore:
Timestamp:
2007-11-30 09:04:12 (2 years ago)
Author:
martinkou
Message:

Fixed #1592 : Fixed the issue where removing a blockquote with an empty paragraph inside would leave empty blockquote blocks behind in IE.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor/trunk/editor/_source/commandclasses/fckblockquotecommand.js

    r1138 r1139  
    3636                range.MoveToSelection() ; 
    3737                var bookmark = range.CreateBookmark() ; 
     38 
     39                // Kludge for #1592: if the bookmark nodes are in the beginning of blockquote, then move them 
     40                // to the nearest block element in the blockquote. 
     41                if ( FCKBrowserInfo.IsIE ) 
     42                { 
     43                        var bStart = range.Window.document.getElementById( bookmark.StartId ) ; 
     44                        var bEnd = range.Window.document.getElementById( bookmark.EndId ) ; 
     45                        var nearestBlock = null ; 
     46 
     47                        if ( bStart && bStart.parentNode.nodeName.IEquals( 'blockquote' )  
     48                                        && bStart == bStart.parentNode.firstChild )  
     49                        { 
     50                                var cursor = bStart ; 
     51                                while ( ( cursor = cursor.nextSibling ) ) 
     52                                { 
     53                                        if ( FCKListsLib.BlockElements[cursor.nodeName.toLowerCase()] ) 
     54                                                cursor.insertBefore( bStart.parentNode.removeChild( bStart ), cursor.firstChild ) ; 
     55                                } 
     56                        } 
     57 
     58                        if ( bEnd && bEnd.parentNode.nodeName.IEquals( 'blockquote' )  
     59                                        && bEnd == bEnd.parentNode.firstChild )  
     60                        { 
     61                                var cursor = bEnd ; 
     62                                while ( ( cursor = cursor.nextSibling ) ) 
     63                                { 
     64                                        if ( FCKListsLib.BlockElements[cursor.nodeName.toLowerCase()] ) 
     65                                        { 
     66                                                var insertPoint = cursor.firstChild ; 
     67                                                if ( cursor.firstChild == bStart ) 
     68                                                        insertPoint = bStart.nextSibling ; 
     69                                                cursor.insertBefore( bEnd.parentNode.removeChild( bEnd ), insertPoint ) ; 
     70                                        } 
     71                                } 
     72                        } 
     73                } 
     74 
    3875                var iterator = new FCKDomRangeIterator( range ) ; 
    3976                var block ;