Changeset 908

Show
Ignore:
Timestamp:
2007-09-29 00:17:02 (14 months ago)
Author:
alfonsoml
Message:

Fix for #389, avoid errors in the Paste dialog, and focus the area on load.

Location:
FCKeditor/trunk
Files:
2 modified

Legend:

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

    r840 r908  
    5151                oFrame.style.display = '' ; 
    5252 
     53                // Avoid errors if the pasted content has any script that fails: #389 
     54                var oDoc = oFrame.contentWindow.document ; 
     55                oDoc.open() ; 
     56                oDoc.write('<html><head><script>window.onerror = function() { return true ; };<\/script><\/head><body><\/body><\/html>') ; 
     57                oDoc.close() ; 
     58                 
    5359                if ( oFrame.contentDocument ) 
    5460                        oFrame.contentDocument.designMode = 'on' ; 
    5561                else 
    5662                        oFrame.contentWindow.document.body.contentEditable = true ; 
     63 
     64                // Set the focus on the pasting area 
     65                oFrame.contentWindow.focus(); 
    5766        } 
    5867        else 
     
    223232 
    224233        // Remove comments [SF BUG-1481861]. 
    225         html = html.replace(/<\!--.*-->/g, '' ) ; 
     234        html = html.replace(/<\!--.*?-->/g, '' ) ; 
    226235 
    227236        html = html.replace( /<(U|I|STRIKE)>&nbsp;<\/\1>/g, '&nbsp;' ) ; 
     
    231240        // Remove "display:none" tags. 
    232241        html = html.replace( /<(\w+)[^>]*\sstyle="[^"]*DISPLAY\s?:\s?none(.*?)<\/\1>/ig, '' ) ; 
     242 
     243        // Remove language tags 
     244        html = html.replace( /<(\w[^>]*) language=([^ |>]*)([^>]*)/gi, "<$1$3") ; 
     245 
     246        // Remove onmouseover and onmouseout events (from MS Word comments effect) 
     247        html = html.replace( /<(\w[^>]*) onmouseover="([^\"]*)"([^>]*)/gi, "<$1$3") ; 
     248        html = html.replace( /<(\w[^>]*) onmouseout="([^\"]*)"([^>]*)/gi, "<$1$3") ; 
    233249 
    234250        if ( FCKConfig.CleanWordKeepsStructure ) 
  • FCKeditor/trunk/_whatsnew.html

    r866 r908  
    257257                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1227">#1227</a>] The color 
    258258                        commands used an unnecessary temporary variable. Thanks to Matthias Miller</li> 
     259                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/389">#389</a>] Pasting text with 
     260                        comments from Word won't generate errors in IE, thanks to the idea from Swift.</li> 
     261                <li>The pasting area in the Paste from Word dialog is focused on initial load</li> 
     262                <li>Some fixes related to html comment handling in the Word clean up routine</li> 
    259263        </ul> 
    260264        <h3>