Changeset 1062

Show
Ignore:
Timestamp:
2007-11-03 11:59:38 (2 years ago)
Author:
alfonsoml
Message:

Fix for #1496. Improve the handling of image map areas.

Location:
FCKeditor/trunk/editor/_source/internals
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor/trunk/editor/_source/internals/fck.js

    r988 r1062  
    287287                html = html.replace( FCKRegexLib.ProtectUrlsImg , '$& _fcksavedurl=$1' ) ; 
    288288 
     289                // <AREA> href 
     290                html = html.replace( FCKRegexLib.ProtectUrlsArea        , '$& _fcksavedurl=$1' ) ; 
     291 
    289292                return html ; 
    290293        }, 
  • FCKeditor/trunk/editor/_source/internals/fckregexlib.js

    r851 r1062  
    7575ProtectUrlsImg  : /<img(?=\s).*?\ssrc=((?:(?:\s*)("|').*?\2)|(?:[^"'][^ >]+))/gi , 
    7676ProtectUrlsA    : /<a(?=\s).*?\shref=((?:(?:\s*)("|').*?\2)|(?:[^"'][^ >]+))/gi , 
     77ProtectUrlsArea : /<area(?=\s).*?\shref=((?:(?:\s*)("|').*?\2)|(?:[^"'][^ >]+))/gi , 
    7778 
    7879Html4DocType    : /HTML 4\.0 Transitional/i , 
  • FCKeditor/trunk/editor/_source/internals/fckxhtml_ie.js

    r706 r1062  
    139139} 
    140140 
    141 // IE ignores the "COORDS" and "SHAPE" attribute so we must add it manually. 
    142 FCKXHtml.TagProcessors['area'] = function( node, htmlNode ) 
    143 { 
    144         if ( ! node.attributes.getNamedItem( 'coords' ) ) 
    145         { 
    146                 var sCoords = htmlNode.getAttribute( 'coords', 2 ) ; 
    147                 if ( sCoords && sCoords != '0,0,0' ) 
    148                         FCKXHtml._AppendAttribute( node, 'coords', sCoords ) ; 
    149         } 
    150  
    151         if ( ! node.attributes.getNamedItem( 'shape' ) ) 
    152         { 
    153                 var sShape = htmlNode.getAttribute( 'shape', 2 ) ; 
    154                 if ( sShape && sShape.length > 0 ) 
    155                         FCKXHtml._AppendAttribute( node, 'shape', sShape.toLowerCase() ) ; 
    156         } 
    157  
    158         return node ; 
    159 } 
    160  
    161141FCKXHtml.TagProcessors['label'] = function( node, htmlNode ) 
    162142{ 
     
    207187        return node ; 
    208188} 
     189 
     190// Fix behavior for IE, it doesn't read back the .name on newly created maps  
     191FCKXHtml.TagProcessors['map'] = function( node, htmlNode ) 
     192{ 
     193        if ( ! node.attributes.getNamedItem( 'name' ) ) 
     194        { 
     195                var name = htmlNode.name ; 
     196                if ( name ) 
     197                        FCKXHtml._AppendAttribute( node, 'name', name ) ; 
     198        } 
     199 
     200        node = FCKXHtml._AppendChildNodes( node, htmlNode, true ) ; 
     201 
     202        return node ; 
     203} 
  • FCKeditor/trunk/editor/_source/internals/fckxhtml.js

    r1032 r1062  
    453453                node.removeAttribute( 'spellcheck' ) ; 
    454454                return node ; 
    455         } 
     455        }, 
     456 
     457        area : function( node, htmlNode ) 
     458        { 
     459                var sSavedUrl = htmlNode.getAttribute( '_fcksavedurl' ) ; 
     460                if ( sSavedUrl != null ) 
     461                        FCKXHtml._AppendAttribute( node, 'href', sSavedUrl ) ; 
     462 
     463                // IE ignores the "COORDS" and "SHAPE" attribute so we must add it manually. 
     464                if ( FCKBrowserInfo.IsIE ) 
     465                { 
     466                        if ( ! node.attributes.getNamedItem( 'coords' ) ) 
     467                        { 
     468                                var sCoords = htmlNode.getAttribute( 'coords', 2 ) ; 
     469                                if ( sCoords && sCoords != '0,0,0' ) 
     470                                        FCKXHtml._AppendAttribute( node, 'coords', sCoords ) ; 
     471                        } 
     472 
     473                        if ( ! node.attributes.getNamedItem( 'shape' ) ) 
     474                        { 
     475                                var sShape = htmlNode.getAttribute( 'shape', 2 ) ; 
     476                                if ( sShape && sShape.length > 0 ) 
     477                                        FCKXHtml._AppendAttribute( node, 'shape', sShape.toLowerCase() ) ; 
     478                        } 
     479                } 
     480 
     481                return node ; 
     482        } 
     483 
    456484} ; 
    457485