Ticket #2411: 2411_2.patch

File 2411_2.patch, 2.1 KB (added by martinkou, 20 months ago)
  • _whatsnew.html

     
    4545                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2407">#2407</a>] Fixed the issue  
    4646                        where FCK.InsertHtml() is no longer removing selected contents after content insertion 
    4747                        in Firefox.</li> 
     48                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2411">#2411</a>] Fixed the issue 
     49                        where insert anchor no longer works for non-empty selections.</li> 
    4850        </ul> 
    4951        <h3> 
    5052                Version 2.6.3 Beta</h3> 
  • editor/dialog/fck_anchor.html

     
    119119        var aNewAnchors = oEditor.FCK.CreateLink( '#' ) ; 
    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        { 
    135125                // Remove the fake href 
     
    142132        { 
    143133                oAnchor = aNewAnchors[i] ; 
    144134 
     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 ; 
     148 
    145149                // IE does require special processing to show the Anchor's image 
    146150                // Opera doesn't allow to select empty anchors 
    147151                if ( FCKBrowserInfo.IsIE || FCKBrowserInfo.IsOpera )