Using TinyMCE with Django's Admin
Update (3/13/2011): this article is obsolete now and preserved here mostly for its historic value. Nowadays I use Dojo’s dijit.Editor as a WYSIWYG HTML editor — it is more functional and much simpler to setup and extend. Read all gory details in Using Dojo Rich Editor with Django’s Admin.
I decided to add a WYSIWYG editor to my admin portion of the site. Apparently you can find some nice open source WYSIWYG editors nowadays. Probably FCKeditor, Xinha and TinyMCE are the most prominent ones. Some people already tried different editors with Django, e.g., Xinha — http://www.socialistsoftware.com/?p=10, TinyMCE — http://www.socialistsoftware.com/?p=8. Now it’s my turn.
I tried Xinha and decided not to use it:
- setup is quite complicated
- the second file is quite big, even for simple configuration a user has to do some dance with Xinha’s internals* the layout of toolbar components was less then perfect, a lot of empty spaces were reserved (?), I didn’t find a way to change it (should I?)
TinyMCE was much more polished. It was extremely easy to setup. Authors provide nice examples, which can be copied directly. Another nice touch is ability to restrict [X]HTML, so it can be used for upcoming Comments by general public.
I didn’t try FCKeditor because it was 3rd on my list (I don’t know why) but I was already satisfied by TinyMCE.
I’ll try out TinyMCE and report all problems I encounter.
BTW, this post was typed using regular MS Word. Later on I’ll cut’n’paste it to my blog. If you can read it, it means it works.
Update: It works but has some strange quirks. It flickers every time I use backspace. When I tried to paste text from Word it did nothing but complained that Paste to Mozilla browsers (I use FireFox) is not supported. When I tried one more time it pasted just fine preserving all formatting. But it turned out that now I had two copies of my text.
_Some quirks can be blamed on auto_resize option, which is experimental._
_Another problem is TinyMCE’s strange behavior when media and active contents are served by different web servers. E.g., my local setup does it because I use Django’s own runserver for debugging and IIS for all static contents. It confuses TinyMCE._
Oh, well. I can live with that for now.