As you might know, LOTS of junk formatting gets brought over if a user cuts and pastes straight from Word into a field that’s modified by TinyMCE on some browsers on some platforms. This junk causes real problems for some older versions of IE. The “paste from word” button has mixed results at best and chasing down javascript issues was not something I wanted to spend my life doing. The folks working on TinyMCE are struggling enough with this. Users have resorted to first pasting content into plain text editor first. This is obviously less than ideal if your site is being used by less savvy users.
My solution was to use something far more reliable: php. I wrote a tiny plug-in that strips out any comments.
The function is super simple…
/** ----------------------------------------
/** Comment stripper
/** ----------------------------------------*/
function Comment_strip()
{
global $TMPL;
$dog= $TMPL->tagdata;
$dog = preg_replace('@<![\s\S]*?--[ \t\n\r]*>@', "", $dog);
$this->return_data = $dog;
}
/* END */