Snippet List
Django Template Tag Filter stack to clean up output from [widgEditor](http://www.themaninblue.com/experiment/widgEditor/) or other WYSIWYG text-input box. Removes arbitrary line break code and replaces with Django's cleaner `|linebreaks` filter. Also removes any arbitrary styling, leaving in things like bold, italic, link and image tags.
Widget for TinyMCE 3.2.6, a WYSIWYG HTML editor for `textarea`.
**Note:**
> This snippet uses the TinyMCE package thats contains special jQuery build of TinyMCE and a jQuery integration plugin. Anyway, is easily to adapt to standard package.
Usage example:
from django.contrib.flatpages.admin import FlatpageForm
class MyFlatPageForm(FlatpageForm):
content = forms.CharField(widget=TinyMCEEditor())
[TinyMCE download page](http://tinymce.moxiecode.com/download.php)
- forms
- wysiwyg
- form
- widget
- modelform
- tinymce
My admin allows editing of some html fields using TinyMCE, so I end up with horrible code that contains lots of nested `<p>`, `<div>`, `<span>` tags, and style properties which destroy my layout and consistence.
This tag based on lxml tries to kill as much unneeded tags as possible, and style properties. These properties can be customized by adapting the regex to your needs.
- html
- wysiwyg
- tinymce
- lxml
- dirty
- cleanup
When using a JavaScript WYSIWYG editor widget for text area content, the resulting HTML should be sanitized so no unallowed HTML tags (esp. script tags) are present.
The [BeautifulSoup](http://www.crummy.com/software/BeautifulSoup/) library handles HTML processing in the solution presented above, so you should place it in the Python path.
The snippet also assumes that you have [the Dojo Toolkit](http://dojotoolkit.org/) and its Editor2 widget loaded on your page.
**Note**: this snippet was originally written for use with Dojo Toolkit 0.4, and it hasn't been updated for 0.9 or 1.0.
- forms
- html
- wysiwyg
- dojo
- security
- sanitize
4 snippets posted so far.