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

tinymce 4.0 compatibility #47

Open jpatel3 opened 9 years ago

jpatel3 commented 9 years ago

It seems like it only works with tinymce 3.0. with 4.0 lot of file names has been changed, which causes issue while using it with 4.0.

any recommendation?

ghost commented 9 years ago

You can extend django-wysiwyg. In order to do that, you have to create two templates :

And then, you change the flavor in your settings :

    DJANGO_WYSIWYG_FLAVOR = 'tinymce4'

You can copy-paste the templates of django_wysiwyg/tinymce or django_wysiwyg/tinymce_advanced and edit the config.

For instance, this is the content of django_wysiwyg/tinymce_advanced/editor_instance.html :

{% extends 'django_wysiwyg/tinymce/editor_instance.html' %}

And the content of django_wysiwyg/tinymce_advanced/includes.html, where you can change the config :

{% extends 'django_wysiwyg/tinymce/includes.html' %}

{% block django_wysiwyg_editor_config %}
    var django_wysiwyg_editor_config = {
        'menubar': false # change the config here
    };
{% endblock %}

At last, if you copy the tinymce flavor files, you must change the src attribute of the first script in order to get the right file. Otherwise, you have to use the development package of TinyMCE and you need to create a link from tiny_mce_src.js to tinymce.js.