Django-TinyMCE: how to configure it correctly?

I messed around with django-tinyMCE and noticed that some of the configurations are not applicable. Here is the code from my settings .py

TINYMCE_DEFAULT_CONFIG = { 'theme' : 'advanced', 'theme_advanced_buttons1' : 'bold,italic,underline,separator,bullist,numlist,separator,link,unlink', 'theme_advanced_buttons2' : '', 'theme_advanced_buttons3' : '', 'theme_advanced_toolbar_location' : 'top', 'theme_advanced_toolbar_align': 'left', 'paste_text_sticky': 'true', 'paste_text_sticky_default' : 'true', 'valid_styles' : 'font-weight,font-style,text-decoration', } 

Those that do not work: paste_text_sticky, paste_text_sticky_default and valid_styles.

I am basically trying to do the following:

Allow only

  • the text will be bold / italic / underlined
  • (bullets, numbers)
  • links

Everything else is prohibited.

Do you have an idea what I'm doing wrong? Thank you very much.

+4
source share
1 answer

You need to use Python True / False for paste_text_sticky and paste_text_sticky_default .

 TINYMCE_DEFAULT_CONFIG = { 'theme' : 'advanced', 'theme_advanced_buttons1' : 'bold,italic,underline,separator,bullist,numlist,separator,link,unlink', 'theme_advanced_buttons2' : '', 'theme_advanced_buttons3' : '', 'theme_advanced_toolbar_location' : 'top', 'theme_advanced_toolbar_align': 'left', 'paste_text_sticky': True, 'paste_text_sticky_default' : True, 'valid_styles' : 'font-weight,font-style,text-decoration', } 

Take a look at this post related to valid child elements and styles. Hope this helps you.

+7
source

Source: https://habr.com/ru/post/1432902/


All Articles