Changeset 1053

Show
Ignore:
Timestamp:
2007-10-30 15:07:06 (2 years ago)
Author:
fredck
Message:

Fixed #1431 : The selection was not correctly positioned inside <pre> when pressing enter.

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

Legend:

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

    r1029 r1053  
    6767} 
    6868 
    69 FCKDomRange.prototype.Select = function() 
     69FCKDomRange.prototype.Select = function( forceExpand ) 
    7070{ 
    7171        if ( this._Range ) 
    72                 this.SelectBookmark( this.CreateBookmark( true ) ) ; 
     72                this.SelectBookmark( this.CreateBookmark( true ), forceExpand ) ; 
    7373} 
    7474 
    7575// Not compatible with bookmark created with CreateBookmark2. 
    7676// The bookmark nodes will be deleted from the document. 
    77 FCKDomRange.prototype.SelectBookmark = function( bookmark ) 
     77FCKDomRange.prototype.SelectBookmark = function( bookmark, forceExpand ) 
    7878{ 
    7979        var bIsCollapsed = this.CheckIsCollapsed() ; 
     
    112112        else 
    113113        { 
    114                 bIsStartMakerAlone = ( !eStartMarker.previousSibling || eStartMarker.previousSibling.nodeName.toLowerCase() == 'br' ) && !eStartMarker.nextSibing ; 
     114                bIsStartMakerAlone = ( forceExpand || !eStartMarker.previousSibling || eStartMarker.previousSibling.nodeName.toLowerCase() == 'br' ) && !eStartMarker.nextSibing ; 
    115115                 
    116116                // Append a temporary <span>&nbsp;</span> before the selection. 
  • FCKeditor/trunk/editor/_source/classes/fckenterkey.js

    r1048 r1053  
    519519 
    520520                var bHasShift = this._HasShift ; 
     521                var bIsPre = false ; 
    521522 
    522523                if ( !bHasShift && sStartBlockTag == 'LI' ) 
     
    538539                else 
    539540                { 
    540                         var eLineBreak = null ; 
    541                         if ( sStartBlockTag.IEquals( 'pre' ) ) 
     541                        var eLineBreak ; 
     542                        bIsPre = sStartBlockTag.IEquals( 'pre' ) ; 
     543                        if ( bIsPre ) 
    542544                                eLineBreak = this.Window.document.createTextNode( FCKBrowserInfo.IsIE ? '\r' : '\n' ) ; 
    543545                        else 
     
    575577                oRange.Collapse( true ) ; 
    576578 
    577                 oRange.Select() ; 
     579                oRange.Select( bIsPre ) ; 
    578580        } 
    579581