首页> 软件配置及服务 >软件配置 >其它软件配置 其它软件配置
ckeditor增加编辑代码功能--使用官方推荐Code Snippet插件
作者:小萝卜 2019-05-27 【 CKEditor 】 浏览 3212
简介ckeditor增加编辑代码功能--使用官方推荐Code Snippet插件
使用ckeditor这个编辑器的时候,对于经常写博客的同学当然希望能有 ,增加代码这个功能按钮,而这个按钮 需要自己配置, 我们的编辑器自然需要添加代码块的功能。
需要用到插件codesnippet,ckeditor(4.4版本对这个代码插件兼容比较好,建议用这个版本)的插件放在了/ckeditor/plugins/路径下。
codesnippet下载地址:https://ckeditor.com/cke4/addon/codesnippet
按上述操作下载安装之后打开/ckeditor/config.js 在里面添加codesnippet插件
CKEDITOR.editorConfig = function (config) {
//添加插件,多个插件用逗号隔开
config.extraPlugins = 'codesnippet';
//使用zenburn的代码高亮风格样式 PS:zenburn效果就是黑色背景
//如果不设置着默认风格为default
config.codeSnippet_theme = 'zenburn';
}
这样就完成了这里有一点需要注意,如果按照上面添加插件的步骤而出现下面这几个错误:
CKEDITOR.resourceManager.load] Resource name "widget" was not found at"http://localhost:16577/Scripts/ckeditor/plugins/widget/plugin.js?t=
[CKEDITOR.resourceManager.load] Resource name "lineutils" was not found at "http://localhost:16577/Scripts/ckeditor/plug
CKEDITOR.resourceManager.load] Resource name "widgetselection" was not found at"http://localhost:16577/Scripts/ckeditor/plugins/widget/plugin.js?t=
这是因为下载的CKEditor缺少widget和lineutils插件,到官网将这几个插件下载下来,只要将这两个插件解压到ckeditor文件夹下的plugins文件夹内就可以了。一般是先出现第一个widget插件无法找到的错误,添加了widget插件后才会出现第二个找不到lineutils插件的错误,可见Code Snippet需要依靠这两个插件。这几个插件的下载地址如下:
- http://ckeditor.com/addon/widget
- https://ckeditor.com/addon/lineutils
- https://ckeditor.com/cke4/addon/widgetselection
将下载的三个插件解压之后放到/ckeditor/plugins/路径下这样就完成了!
配置玩了之后记得清下缓存哦,浏览器缓存!
很赞哦! (0)
相关文章
- Godaddy教程-在Apache服务器(CentOS)上手动安装SSL证书
- 在windows下如何查看80端口占用情况?是被哪个进程占用?如何终止?
- Linux下运行getwaywork 报错stream_socket_server() has been disabled for security reasons in file
- JS 异步分段上传文件
- oneinstack——SSL证书更新
- Robots.txt文件的作用及定义方法
- vscode运行yarn命令报错yarn : 无法加载文件 C:\Users\admin\AppData\Roaming\npm\yarn.ps1,因为在此系统上禁止运行脚本。
- 抓包工具charles安装配置教程
- Drupal7 Views模块
- windows生成git ssh密钥