tinyMCE Cleaner plugin for ExpressionEngine
Note: Since version 1.4 of ExpressionEngine TinyMCE has been installable through an Extension. This is a much better way of installing. You can pick up the Extension right here
I have created a plugin for ExpressionEngine which cleans up some of the mess that tinyMCE leaves behind.
tinyMCE is a terrific ‘wysiwyg’ tool to help your content editors add a few formatting styles to the text that is entered into the fields in the ‘publish’ part of the control panel. The problem is that, by giving your editors (and I presume that you are using ExpressionEngine as a content management system rather than just a ‘blogging’ tool) - too much control, then there is a danger that this text formatting introduced anomalies in the markup of your pages. I have found that users of tinyMCE inadvertently wrap header tags in paragraph tags, introduce breaks in list, wrap paragraphs in paragraphs and enter empty paragraphs. Some of this happens when text is entered directly, but sometimes it happens when text is pasted into the fields from a word processor. The text, may include line breaks where paragraphs were intended, and you may even find other things happening that I have not even noticed!
furthermore...
Download the plugin from here I built this plugin for my own use and, as such, I may keep modifying, if I notice other anomolies creeping in. I do not intend to criticise MoxieCode for the excellent work that they have done on tinyMCE. In fact I think the tool works really well for an experienced user. The problem is, that I am using ExpressionEngine as a contentent management system for users who will be unaware of any issues when they first click a header tag and then hit a paragraph tag. To them, it 'looks' ok. The plugin uses a combination of search and replace and regular expressions to tidy things up. This plugin is meant to be used in conjunction with 'tinyMCE' - a wysywig entry system from MoxieCode If you use this tool to help your editors add some formatting (emphasising the text, italicising the text, adding headers etc), then you will notice that certain things can go wrong and prevent your pages from validating. I suggest that you confige tinyMCE to only use a limited amount of tools (in other words - don't give too much formatting control to your content editors). This plugin removes double <p> and </p> tags. It also removes <p> tags where they wrap <ul> tags There is but one option: If you want to change breaks into paragraphs then put: breaks2paras="yes" It will then change br tags to paragraphs and then remove the empty paragraphs It also removes paragraph tags that get put into header tags To use this plugin, wrap anything you want to be processed by it between these tag pairs: {exp:clean_tinymce break2paras="yes"} text you want processed {/exp:clean_tinymce}Posted on 24 May around 1pm
Tags: ExpressionEngine