pydanny / django-wysiwyg

A Django application for making Django textareas rich text editors. Certainly as a template tag and possibly as a form widget.
http://django-wysiwyg.readthedocs.org
MIT License
465 stars 63 forks source link

wysiwyg.py - wysiwyg_editor method can pass "None" to javascript, failing to load #30

Closed dachachacha closed 11 years ago

dachachacha commented 11 years ago

added an additional check to convert config varialble to "null" if None. Otherwise "None" is passed to the javascript and it fails.

xenovacivus commented 11 years ago

I'd like this fixed too.

Line 39 of wysiwyg.py:

def wysiwyg_editor(field_id, editor_name=None, config=None):

"None" should be changed to "'null'", since it's subsequently passed into js (var config = {{ config }}). If {{ config }} resolves to "None", it will have an error and no editor will load.

As a workaround, I'm using the following template call to wysiwyg_editor and explicitely setting config to null:

{% wysiwyg_editor "textarea_id" editor_name='im_a_editor' config='null'%}
vdboor commented 11 years ago

This should be fixed in the recent 0.5.1 release.

(the fix is in fc20980dbdb94d6b5e6a3098b112a46406265b8d)