【发布时间】:2017-11-26 23:54:50
【问题描述】:
在我的网页中,我们只允许用户使用 H3 和 H4,但将它们视为“标题 3”和“标题 4”会让人感到困惑。我想将它们重命名为“标题”和“副标题”,但设置 format_h3.name 似乎并没有影响。
我无法编写自定义 JS 来配置编辑器,因为我使用的是 Django 插件,它实际上将 python 字典转换为最终使用的 JSON 配置。
我尝试的相关部分如下:
CKEDITOR_CONFIGS = {
'default': {
'allowedContent': 'h3 h4 p b i u a[*]',
'format_p': {'name': 'Standard text', 'element': 'p'},
'format_h3': {'name': 'Title', 'element': 'h3'},
'format_h4': {'name': 'Subtitle', 'element': 'h4'},
'toolbar': [
{'name': 'styles', 'items': ['Format']},
{'name': 'basicstyles', 'items': ['Bold', 'Italic', 'Underline', '-', 'RemoveFormat']},
{'name': 'links', 'items': ['Link', 'Unlink']},
]
}
}
【问题讨论】: