Django ckeditor安装 markdown插件
由于安装的ckeditor没有markdown功能,所以需要手动安装这个插件,我的ckeditor是ckeditor4,所以我到该网站https://ckeditor.com/cke4/addon/markdown下载markdown插件包,下载完成后通过下述命令或解压软件解压
unzip markdown_1.0.zip
解压完成后将其复制到下述路径(即django-ckeditor包所在位置)
site-packages/ckeditor/static/ckeditor/ckeditor/plugins
复制完成后进入到markdown目录,修改plugin.js文件49行
textarea.addClass('cke_source', 'cke_reset', 'cke_enable_context_menu'); # 修改成这样
//textarea.addClass('cke_source cke_reset cke_enable_context_menu');
否则会报下列错误:Failed to execute 'add' on 'DOMTokenList': The token provided ('cke_source cke_reset cke_enable_context_menu') contains HTML space characters, which are not valid in tokens.
然后在django的setting.py文件中修改CKEDITOR_CONFIGS选项,添加或修改下述信息
'toolbar_Custom':[
['Markdown'],
], # 这个可不添加,经测试没有任何变化
'extraPlugins': ','.join([
...,
'markdown',
...
])
修改完成后,重启即可!
版权声明:本文转载请注明出处!
最新评论:
发表评论
电子邮件地址不会被公开。 必填项已用*标注