Changeset 1141

Show
Ignore:
Timestamp:
2007-11-30 10:28:14 (2 years ago)
Author:
fredck
Message:

Clean up over [1139].

Files:
1 modified

Legend:

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

    r1139 r1141  
    3333 
    3434                var state = this.GetState() ; 
     35 
    3536                var range = new FCKDomRange( FCK.EditorWindow ) ; 
    3637                range.MoveToSelection() ; 
     38 
    3739                var bookmark = range.CreateBookmark() ; 
    3840 
    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                // Kludge for #1592: if the bookmark nodes are in the beginning of 
     42                // blockquote, then move them to the nearest block element in the 
     43                // blockquote. 
    4144                if ( FCKBrowserInfo.IsIE ) 
    4245                { 
    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 ; 
     46                        var bStart      = range.GetBookmarkNode( bookmark, true ) ; 
     47                        var bEnd        = range.GetBookmarkNode( bookmark, false ) ; 
     48                         
     49                        var cursor ; 
     50                         
     51                        if ( bStart  
     52                                        && bStart.parentNode.nodeName.IEquals( 'blockquote' ) 
     53                                        && !bStart.previousSibling ) 
     54                        { 
     55                                cursor = bStart ; 
    5156                                while ( ( cursor = cursor.nextSibling ) ) 
    5257                                { 
    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 ; 
     58                                        if ( FCKListsLib.BlockElements[ cursor.nodeName.toLowerCase() ] ) 
     59                                                FCKDomTools.MoveNode( bStart, cursor, true ) ; 
     60                                } 
     61                        } 
     62 
     63                        if ( bEnd  
     64                                        && bEnd.parentNode.nodeName.IEquals( 'blockquote' ) 
     65                                        && !bEnd.previousSibling ) 
     66                        { 
     67                                cursor = bEnd ; 
    6268                                while ( ( cursor = cursor.nextSibling ) ) 
    6369                                { 
    64                                         if ( FCKListsLib.BlockElements[cursor.nodeName.toLowerCase()] ) 
    65                                         { 
    66                                                 var insertPoint = cursor.firstChild ; 
     70                                        if ( FCKListsLib.BlockElements[ cursor.nodeName.toLowerCase() ] ) 
     71                                        { 
    6772                                                if ( cursor.firstChild == bStart ) 
    68                                                         insertPoint = bStart.nextSibling ; 
    69                                                 cursor.insertBefore( bEnd.parentNode.removeChild( bEnd ), insertPoint ) ; 
     73                                                        FCKDomTools.InsertAfterNode( bStart, bEnd ) ; 
     74                                                else 
     75                                                        FCKDomTools.MoveNode( bEnd, cursor, true ) ; 
    7076                                        } 
    7177                                }