Changeset 211

Show
Ignore:
Timestamp:
2007-03-14 17:44:50 (22 months ago)
Author:
fredck
Message:

Fixed #165 : The enter key now honors the EnterMode settings when outdenting a list item.

Location:
FCKeditor/trunk
Files:
3 modified

Legend:

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

    r208 r211  
    180180        if ( !previous && currentBlock.nodeName.IEquals( 'LI' ) && currentBlock.parentNode.parentNode.nodeName.IEquals( 'LI' ) ) 
    181181        { 
    182                 previous = currentBlock.parentNode.parentNode ; 
    183                 currentBlock = FCKListHandler.OutdentListItem( currentBlock ) ; 
     182                this._OutdentWithSelection( currentBlock, range ) ; 
     183                return true ; 
    184184        } 
    185185 
     
    197197        if ( previous && currentBlock ) 
    198198        { 
    199                 // If we are in a LI, and the previous block is not an LI, we must 
     199                // If we are in a LI, and the previous block is not an LI, we must outdent it. 
    200200                if ( currentBlock.nodeName.IEquals( 'LI' ) && !previous.nodeName.IEquals( 'LI' ) ) 
    201                         currentBlock = FCKListHandler.OutdentListItem( currentBlock ) ; 
    202  
     201                { 
     202                        this._OutdentWithSelection( currentBlock, range ) ; 
     203                        return true ; 
     204                } 
     205                 
    203206                // Take a reference to the parent for post processing cleanup. 
    204207                var oCurrentParent = currentBlock.parentNode ; 
     
    346349                                        if ( bIsStartOfBlock && sStartBlockTag == 'LI' ) 
    347350                                        { 
    348                                                 var eOutdented = FCKListHandler.OutdentListItem( eStartBlock ) ; 
    349                                                 oRange.MoveToElementEditStart( eOutdented ) ; 
     351                                                this._OutdentWithSelection( eStartBlock, oRange ) ; 
     352                                                oRange.Release() ; 
     353                                                return true ; 
    350354                                        } 
    351355                                        else 
     
    545549                target = target.insertBefore( source.cloneNode( false ), target.firstChild ) ; 
    546550} 
     551 
     552// Outdents a LI, maintaining the seletion defined on a range. 
     553FCKEnterKey.prototype._OutdentWithSelection = function( li, range ) 
     554{ 
     555        var oBookmark = range.CreateBookmark() ; 
     556 
     557        FCKListHandler.OutdentListItem( li ) ; 
     558         
     559        range.MoveToBookmark( oBookmark ) ; 
     560        range.Select() ; 
     561} 
  • FCKeditor/trunk/editor/_source/internals/fcklisthandler.js

    r132 r211  
    9999                                } 
    100100 
    101                                 var eBlock = oDocument.createElement( 'p' ) ;   // TODO: Get from configuration. 
     101                                var eBlock = oDocument.createElement( FCKConfig.EnterMode == 'p' ? 'p' : 'div' ) ; 
    102102                                FCKDomTools.MoveChildren( eParent.removeChild( listItem ), eBlock ) ; 
    103103                                FCKDomTools.InsertAfterNode( eParent, eBlock ) ; 
    104104 
    105                                 listItem = eBlock ; 
     105                                if ( FCKConfig.EnterMode == 'br' ) 
     106                                { 
     107                                        // We need the bogus to make it work properly. In Gecko, we 
     108                                        // need it before the new block, on IE, after it. 
     109                                        if ( FCKBrowserInfo.IsGecko ) 
     110                                                eBlock.parentNode.insertBefore( FCKTools.CreateBogusBR( oDocument ), eBlock ) ; 
     111                                        else 
     112                                                FCKDomTools.InsertAfterNode( eBlock, FCKTools.CreateBogusBR( oDocument ) ) ; 
     113 
     114                                        FCKDomTools.RemoveNode( eBlock, true ) ; 
     115                                } 
    106116                        } 
    107117 
     
    109119                                FCKDomTools.RemoveNode( eParent, true ) ; 
    110120                } 
    111  
    112                 return listItem ; 
    113121        }, 
    114122 
  • FCKeditor/trunk/_whatsnew.html

    r210 r211  
    113113                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/209">#209</a>] Links and 
    114114                        images URLs will now be correctly preserved with Netscape 7.1.</li> 
     115                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/165">#165</a>] The enter 
     116                        key now honors the EnterMode settings when outdenting a list item.</li> 
    115117        </ul> 
    116118        <h3>