Changeset 2318

Show
Ignore:
Timestamp:
2008-08-01 04:03:42 (5 months ago)
Author:
martinkou
Message:

Fixed #2411 : Fixed the issue where insert anchor no longer works for non-empty selections.

Location:
FCKeditor/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor/trunk/editor/dialog/fck_anchor.html

    r2287 r2318  
    120120 
    121121        if ( aNewAnchors.length == 0 ) 
    122         { 
    123                 // Nothing was selected, so now just create a normal A 
    124                 if ( FCKBrowserInfo.IsIE ) 
    125                         aNewAnchors.push( oEditor.FCK.InsertElement( '<a name="' + FCKTools.HTMLEncode( sNewName ).replace( '"', '&quot;' ) + '">' ) ) ; 
    126                 else 
    127                 { 
    128                         var n = oEditor.FCK.InsertElement( 'a' ) ; 
    129                         n.name = sNewName ; 
    130                         aNewAnchors.push( n ) ; 
    131                 } 
    132         } 
     122                        aNewAnchors.push( oEditor.FCK.InsertElement( 'a' ) ) ; 
    133123        else 
    134124        { 
     
    142132        { 
    143133                oAnchor = aNewAnchors[i] ; 
     134 
     135                // Set the name 
     136                if ( FCKBrowserInfo.IsIE ) 
     137                { 
     138                        // Setting anchor names directly in IE will trash the HTML code stored 
     139                        // in FCKTempBin after undos. See #2263. 
     140                        var replaceAnchor = oEditor.FCK.EditorDocument.createElement( '<a name="' + 
     141                                        FCKTools.HTMLEncode( sNewName ).replace( '"', '&quot;' ) + '">' ) ; 
     142                        oEditor.FCKDomTools.MoveChildren( oAnchor, replaceAnchor ) ; 
     143                        oAnchor.parentNode.replaceChild( replaceAnchor, oAnchor ) ; 
     144                        oAnchor = replaceAnchor ; 
     145                } 
     146                else 
     147                        oAnchor.name = sNewName ; 
    144148 
    145149                // IE does require special processing to show the Anchor's image 
  • FCKeditor/trunk/_whatsnew.html

    r2317 r2318  
    6363                        where spelling mistake corrections made by the spell checking dialog are not undoable. 
    6464                        </li> 
     65                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2411">#2411</a>] Fixed the issue 
     66                        where insert anchor no longer works for non-empty selections.</li> 
    6567        </ul> 
    6668        <h3>