简体   繁体   English

Django-TinyMCE:如何正确配置?

[英]Django-TinyMCE: How to configure it properly?

I'm fiddling around with django-tinyMCE and noticed that some of the configurations are not getting applied. 我正在摆弄django-tinyMCE并注意到一些配置没有得到应用。 Here is the code from my settings.py 这是我的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',
}

The ones which aren't working are: paste_text_sticky, paste_text_sticky_default and valid_styles. 那些不起作用的是:paste_text_sticky,paste_text_sticky_default和valid_styles。

What I'm basically trying to do is: 我基本上要做的是:

Only allow 只允许

  • the text to be "bold/italic/underlined" 文字是“粗体/斜体/下划线”
  • lists (bullets, numbers) 清单(子弹,数字)
  • links 链接

Everything else is forbidden. 其他一切都是被禁止的。

Do you have an idea what I'm doing wrong? 你知道我做错了什么吗? Thanks a lot. 非常感谢。

You need to use Python True/False for paste_text_sticky and paste_text_sticky_default . 您需要对paste_text_stickypaste_text_sticky_default使用Python True / False。

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 Stack Overflow post related to valid children and styles. 看一下与有效子项和样式相关的Stack Overflow帖子 Hope that helps you out. 希望能帮到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM