Editing the raw HTML inside a TinyMCE control

Ram Rachum picture Ram Rachum · Feb 20, 2010 · Viewed 9.7k times · Source

I have a Django website in which I use django-tinymce to edit HTML fields with a TinyMCE control.

TinyMCE practically gives me a WYSIWYG way to edit HTML. My question is, can I get access to edit the underlying HTML directly? I was thinking, maybe there's some button I can enbale which will toggle between "WYSIWYG mode" and "raw html mode" in TinyMCE. Is there one? If not, is there any elegant way to edit the HTML?

Answer

Benjamin Wohlwend picture Benjamin Wohlwend · Feb 20, 2010

Simply add the code button to one of the toolbars, e.g. with this configuration for django-tinymce:

TINYMCE_DEFAULT_CONFIG = {
    # your other configuration
    'theme_advanced_buttons3_add': 'code',
}

Here's a list of buttons that are available with the advanced TinyMCE theme