我在摆弄django-tinyMCE,注意到有些配置没有得到应用。这是我设置的代码.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',
}
不起作用的有:粘贴文本_粘贴默认和有效样式。
我基本上想做的是:
只允许
- 要"粗体/斜体/下划线"的文本
- 列表(项目符号、数字)
- 链接
其他一切都是被禁止的。
你知道我做错了什么吗?非常感谢。
您需要对paste_text_sticky
和paste_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',
}
看看这篇Stack Overflow帖子,它与有效的子项和样式有关。希望这能帮助你。