Well, I can't be the only one with this problem, which seems to go on forever and always.
We use browser-based html editors (several different ones) - each of them has its own button "insert from a word", which works fine.
However, many of our users are simply inserted directly from the word into the design field. For us, this leads to the end of the world - sometimes it breaks javascript or other things too numerous to mention.
So, I decided to write a simple function that looks for the contents of the source code, and if it sees any bad characters associated with the palette in Microsoft Word, to discard the match โit looks like ms groove wordsโ. Currently it looks like this:
// detect potentially bad characters - usually from msword paste function hasInvalidChars ( in_element ) { var src = $j(in_element).val(); var e = $E(src); // enhanced string var bad = Array( "mso-list:", "class=\"Mso", "</o:p>", "[if !supportLists]", "style=\"mso-", "mso-bidi", """, """, "<v:shapetype", "<v:path", "file:///" ); for ( i=0; i< bad.length; i++ ) { if ( e.contains(bad[i]) ) { return true; } } return false; }
Please note that if you try to run the code, this will not work, because (1) I use jQuery and (2) I have a special object ($ E) that adds a bunch of material to the string, the 'contains ()' function, but you get an idea of โโwhat she is doing.
I am looking for array elements that refer to the "bad []" array. I came up with a tentative list (which may or may not be a good starting point), but I ask you experts, please, can you tell me which characters or phrases you put here? At the moment, if I could catch 80% of the questions, I would be delighted.
Thanks.