【问题标题】:Django-TinyMCE: How to configure it properly?Django-TinyMCE:如何正确配置?
【发布时间】:2012-09-07 09:02:20
【问题描述】:

我在摆弄django-tinyMCE 并注意到一些配置没有得到应用。这是我的 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',
}

不工作的是: paste_text_sticky、paste_text_sticky_default 和 valid_styles。

我基本上想做的是:

只允许

  • 文本为“粗体/斜体/下划线”
  • 列表(项目符号、数字)
  • 链接

其他的都是禁止的。

你知道我做错了什么吗?非常感谢。

【问题讨论】:

    标签: django django-forms tinymce


    【解决方案1】:

    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',
    }
    

    看看这个Stack Overflow post 与有效的子元素和样式相关。希望对您有所帮助。

    【讨论】:

      猜你喜欢
      • 2021-02-18
      • 2023-03-26
      • 1970-01-01
      • 2018-06-04
      • 2021-05-30
      • 2019-09-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多