Clean Microsoft Word Pasted Text using JavaScript

Posted by OneNerd on Stack Overflow See other posts from Stack Overflow or by OneNerd
Published on 2010-05-20T15:07:21Z Indexed on 2010/05/20 15:20 UTC
Read the original article Hit count: 277

Filed under:
|
|

I am using a 'contenteditable' div and enabling PASTE.

It is amazing the amount of markup code that gets pasted in from a clipboard copy from Microsoft Word. I am battling this, and have gotten about 1/2 way there using Prototypes' stripTags() function (which unfortunately does not seem to enable me to keep some tags).

However, even after that, I wind up with a mind-blowing amount of unneeded markup code.

So my question is, is there some function (using JavaScript), or approach I can use that will clean up the majority of this unneeded markup?

Thanks -

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about paste