Changeset 2174

Show
Ignore:
Timestamp:
2008-07-04 09:54:43 (2 months ago)
Author:
martinkou
Message:

Fixed #2272 : Improved the garbage filter in Paste from Word dialog.

Location:
FCKeditor/trunk
Files:
2 modified

Legend:

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

    r1565 r2174  
    188188 
    189189        html = html.replace(/<o:p>\s*<\/o:p>/g, '') ; 
    190         html = html.replace(/<o:p>.*?<\/o:p>/g, '&nbsp;') ; 
     190        html = html.replace(/<o:p>[\s\S]*?<\/o:p>/g, '&nbsp;') ; 
    191191 
    192192        // Remove mso-xxx styles. 
     
    225225                html = html.replace( /<(\w[^>]*) style="([^\"]*)"([^>]*)/gi, "<$1$3" ) ; 
    226226 
     227        // Remove style, meta and link tags 
     228        html = html.replace( /<STYLE[^>]*>[\s\S]*?<\/STYLE[^>]*>/gi, '' ) ; 
     229        html = html.replace( /<(?:META|LINK)[^>]*>\s*/gi, '' ) ; 
     230 
    227231        // Remove empty styles. 
    228232        html =  html.replace( /\s*style="\s*"/gi, '' ) ; 
     
    235239        html = html.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3") ; 
    236240 
    237         html = html.replace( /<SPAN\s*>(.*?)<\/SPAN>/gi, '$1' ) ; 
    238  
    239         html = html.replace( /<FONT\s*>(.*?)<\/FONT>/gi, '$1' ) ; 
     241        html = html.replace( /<SPAN\s*>([\s\S]*?)<\/SPAN>/gi, '$1' ) ; 
     242 
     243        html = html.replace( /<FONT\s*>([\s\S]*?)<\/FONT>/gi, '$1' ) ; 
    240244 
    241245        // Remove XML elements and declarations 
    242246        html = html.replace(/<\\?\?xml[^>]*>/gi, '' ) ; 
    243247 
     248        // Remove w: tags with contents. 
     249        html = html.replace( /<w:[^>]*>[\s\S]*?<\/w:[^>]*>/gi, '' ) ; 
     250 
    244251        // Remove Tags with XML namespace declarations: <o:p><\/o:p> 
    245252        html = html.replace(/<\/?\w+:[^>]*>/gi, '' ) ; 
    246253 
    247254        // Remove comments [SF BUG-1481861]. 
    248         html = html.replace(/<\!--.*?-->/g, '' ) ; 
     255        html = html.replace(/<\!--[\s\S]*?-->/g, '' ) ; 
    249256 
    250257        html = html.replace( /<(U|I|STRIKE)>&nbsp;<\/\1>/g, '&nbsp;' ) ; 
     
    253260 
    254261        // Remove "display:none" tags. 
    255         html = html.replace( /<(\w+)[^>]*\sstyle="[^"]*DISPLAY\s?:\s?none(.*?)<\/\1>/ig, '' ) ; 
     262        html = html.replace( /<(\w+)[^>]*\sstyle="[^"]*DISPLAY\s?:\s?none[\s\S]*?<\/\1>/ig, '' ) ; 
    256263 
    257264        // Remove language tags 
     
    268275 
    269276                // Word likes to insert extra <font> tags, when using MSIE. (Wierd). 
    270                 html = html.replace( /<(H\d)><FONT[^>]*>(.*?)<\/FONT><\/\1>/gi, '<$1>$2<\/$1>' ); 
    271                 html = html.replace( /<(H\d)><EM>(.*?)<\/EM><\/\1>/gi, '<$1>$2<\/$1>' ); 
     277                html = html.replace( /<(H\d)><FONT[^>]*>([\s\S]*?)<\/FONT><\/\1>/gi, '<$1>$2<\/$1>' ); 
     278                html = html.replace( /<(H\d)><EM>([\s\S]*?)<\/EM><\/\1>/gi, '<$1>$2<\/$1>' ); 
    272279        } 
    273280        else 
     
    283290 
    284291                // Transform <P> to <DIV> 
    285                 var re = new RegExp( '(<P)([^>]*>.*?)(<\/P>)', 'gi' ) ; // Different because of a IE 5.0 error 
     292                var re = new RegExp( '(<P)([^>]*>[\\s\\S]*?)(<\/P>)', 'gi' ) ;  // Different because of a IE 5.0 error 
    286293                html = html.replace( re, '<div$2<\/div>' ) ; 
    287294 
  • FCKeditor/trunk/_whatsnew.html

    r2170 r2174  
    7575                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1645">#1645</a>] Added warning message 
    7676                        about Firefox 3's strict origin policy.</li> 
     77                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2272">#2272</a>] Improved the 
     78                        garbage filter in Paste from Word dialog.</li> 
    7779        </ul> 
    7880        <p>