Open GoogleCodeExporter opened 9 years ago
Based on Issue 129 and modified a bit, you can add the code above after block
if ( this.options.css ){...}
on the jquery.wysiwyg.js file.
Note: setTimeout should be called inside the bind..
$(this.editorDoc).bind('paste', function(e){
setTimeout(function() {
//ms word clean-up
var html = self.getContent();
function CleanWord(html)
{
html = html.replace(/<(\/)*(\\?xml:|a|span|p|button|style|font|del|ins|st1:|[ovwxp]:)(.*?)>/gi, '');
html = html.replace(/(class|style|type|start|href)="(.*?)"/gi, '');
html = html.replace( /\s*mso-[^:]+:[^;"]+;?/gi, '' ) ;
html = html.replace(/<\s*(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3");
html = html.replace( /<(\w[^>]*) onmouseover="([^\"]*)"([^>]*)/gi, "<$1$3") ;
html = html.replace( /<(\w[^>]*) onmouseout="([^\"]*)"([^>]*)/gi, "<$1$3") ;
html = html.replace(/<script(.*?)script>/gi, '');
html = html.replace(/<!--(.*?)-->/gi, '');
html = html.replace(/<\/?(span)[^>]*>/gi, '');
html = html.replace(/<\/?(span)[^>]*>/gi, '');
html = html.replace( /<\/?(img|font|style|p|div|v:\w+)[^>]*>/gi, '');
html = html.replace( /\s*style="\s*"/gi, '' ) ;
html = html.replace( /<SPAN\s*[^>]*>\s* \s*<\/SPAN>/gi, ' ' ) ;
html = html.replace( /<SPAN\s*[^>]*><\/SPAN>/gi, '' ) ;
return html;
}
//call the function and replace the current content with the clean one
self.setContent(CleanWord(html));
self.saveContent();
// alert(self.getContent());
}, 100);
Original comment by andrea.d...@gmail.com
on 9 Mar 2011 at 1:21
Original issue reported on code.google.com by
richi.ra...@gmail.com
on 1 Oct 2010 at 8:36