我試圖自定義django-ckeditor
工具欄。無法自定義django-ckeditor工具欄
我模式領域是:
answer = RichTextField(
verbose_name = "Answer presented to user",
config_name = 'answer_ckeditor',
)
在settings.py我
CKEDITOR_CONFIGS = {
'answer_ckeditor': {
'skin': 'moono',
#'skin': 'office2013',
'toolbar': [
{'name': 'basicstyles',
'items': ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat']},
{'name': 'paragraph',
'items': ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-',
'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl',
'Language']},
{'name': 'styles', 'items': ['Styles', 'Format', 'Font', 'FontSize']},
{'name': 'colors', 'items': ['TextColor', 'BGColor']},
],
}
}
我HTML是:
<textarea id="answer_1" name="answer_1" required class="form-control quiz-search-box" placeholder="Option 1"></textarea>
<script>
CKEDITOR.replace('answer_1');
</script>
我只是得到標準ckeditor菜單。我試過使用默認值,並從字段定義中刪除config_name,但沒有區別。
有什麼不同我需要在JavaScript CKEDITOR.replace('answer_1');
中做,讓它拿起我的工具欄?
是的,我試過了,它沒有工作。我的解決方案是有效的 – HenryM