Created
December 14, 2009 09:36
-
-
Save choonkeat/255940 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Minimum tinymce config for MS-Word sanity | |
Based on http://tinymce.moxiecode.com/examples/example_05.php | |
*/ | |
tinyMCE.init({ | |
setup : function(ed) { | |
ed.onPostProcess.add(function(ed, o) { | |
if (o.get) { | |
// cleaning up white spaces, remove unnecessary tags | |
// p, span, em should have no attributes (unlike img or a) | |
o.content = o.content. | |
replace(/\ /g, ' '). | |
replace(/\n\n*/gi, ''). | |
replace(/<!--.+?-->|<(meta|link|style)[^>]*\/>/gi, ''). | |
replace(/<(style)\b[^>]*>.*?<\/\1>|<(\w+)\b[^>]*>\s*?<\/\2>/gi, ''). | |
replace(/<(p|span|em)\b[^>]+>/gi, '<$1>'); | |
} | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment