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?
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
django-tinymce version 3 uses TinyMCE version 5 that requires enabling the code button plugin and adding the code
button to toolbar
:
TINYMCE_DEFAULT_CONFIG = {
...
'plugins': 'code', # along with other plugins, e.g. 'link lists code'
'toolbar': 'code', # along with other buttons, e.g. 'bold italic | code'
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With