首页 新闻 会员 周边

请教如何在Python-CKEditor中配置CodeSnippet插件来达到代码高亮的效果

0
悬赏园豆:5 [待解决问题]

在学习Django的过程中,最近自己在尝试做一个博客,其中富文本编辑器使用的是CKEditor,其功能也基本能够实现了,但是代码高亮功能采用CodeSnippet插件没有调出来。

首先我的CKEditor版本为4.5.3(CKEditor 4.5.3 (revision 6c70c82)),其中plugins文件夹中自带了CodeSnippet插件

然后在config.js中加入

1 CKEDITOR.editorConfig = function( config ) {
2     config.filebrowserUploadUrl="/blog/upload_img/";
3     config.extraPlugins = 'codesnippet';
4 };

后来查询网上另一博客提到替换为config.extraPlugins = 'clipboard,lineutils,widget,dialog,codesnippet';结果也是一样的

在Django的settings.py中添加:

 1 CKEDITOR_CONFIGS = {
 2     'default': {
 3         'extraPlugins': "codesnippet",
 4         'toolbar': (['div', 'Source', '-', 'Save', 'NewPage', 'Preview', '-', 'Templates'],
 5                     ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-','Print','SpellChecker','Scayt'],
 6                     ['Undo', 'Redo', '-', 'Find', 'Replace', '-', 'SelectAll', 'RemoveFormat'],
 7                     ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton',
 8                      'HiddenField'],
 9                     ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript'],
10                     ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'],
11                     ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
12                     ['Link', 'Unlink', 'Anchor'],
13                     ['Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak'],
14                     ['Styles', 'Format', 'Font', 'FontSize'],
15                     ['TextColor', 'BGColor'],
16                     ['Maximize', 'ShowBlocks', '-', 'About'],
17 
18                     ),
19     }
20 }

在界面中仍然没有能够显示插入代码的图标(如下图)

如果有人了解的话还请不吝赐教,谢谢!!

Todorov的主页 Todorov | 初学一级 | 园豆:197
提问于:2016-03-13 22:23
< >
分享
所有回答(1)
0

http://www.aaron-zhao.com/post/1/

不用谢,找了两个小时。。。。。

bbujing | 园豆:202 (菜鸟二级) | 2017-10-18 18:23
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册