Hello, reader!

My name is Eugene Lazutkin.

I'm a software developer based in the Dallas-Fort Worth metroplex. Lazutkin.com is my professional blog, which contains short writeups and presentations regarding modern web applications. All articles here are written by myself, unless stated otherwise.

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
  • you have to include two JavaScript files: one before and one after Xinha’s htmlarea.js
  • 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.