yahoo ui

Clean html for content pasted from Word into YUI rich text editor

I’ve been trying to come up with a good way to strip out crappy HTML pasted from MS Word into the Yahoo UI’s rich text editor. Thankfully I am not the only person with this problem and my procrastination pays off! Somebody else created a script to do it for me.

AntsCode has a nice tool to Strip Formatting on Paste using YUI Rich Text Editor

His solution is so simple I feel stupid for not thinking of it. He attaches a listener for the cut and paste command. When you paste into the Rich Text Editor it uses the standard YUI HTML stripper, then he goes in and strips out the unwanted word HTML formatting using a series of regular expressions. Clever.

Syndicate content