Extra spacing in TinyMCE after pasting from Word
TinyMCE can add extra empty paragraphs when you insert text from Word. TinyMCE simply wraps each newline into paragraph.
To solve it you need to follow these steps:
- Enable
paste
plugin. - Add handler for parsing inserted text
So your TinyMCE code will look like:
tinyMCE.init({ ... plugins: "paste", paste_auto_cleanup_on_paste : true, paste_postprocess : function(pl, o) { // remove extra line breaks o.node.innerHTML = o.node.innerHTML.replace(/<p.*>\s*(<br>| )\s*<\/p>/ig, ""); } });
See more info on the official wiki
Saturday, March 6th, 2010