虚位以待(AD)
虚位以待(AD)
首页 > CMS教程 > phpcms > 更改kindeditor自带代码高亮插件为ueditor的代码高亮插件

更改kindeditor自带代码高亮插件为ueditor的代码高亮插件
类别:phpcms   作者:码皇   来源:互联网   点击:

更改kindeditor自带代码高亮插件为ueditor的代码高亮插件
首先:下载ueditor,找到third-partySyntaxHighlighter,上传shCoreDefault.cssshCore.js两个文件到 kindeditor/plugins/code/ 目录下。

第二部:修改 kindeditor/plugins/code/ 下的 code.js
    html = '<pre class="prettyprint' + cls + '">n' + K.escape(code) + '</pre> ';
修改成:
    html = '<pre class="brush:' + type + ';
    toolbar:false">n' + K.escape(code) + '</pre>';
第三步:在需要显示代码高亮的文章页头部引入 shCore.js 和 shCoreDefault.css,以phpcms为例:
    <script type="text/javascript" src="{
    JS_PATH}
    kindeditor/plugins/code/shCore.js"></script><link href="{
    JS_PATH}
    kindeditor/plugins/code/shCoreDefault.css" rel="stylesheet" type="text/css" />
第四步:在文章页底部加入调用的js代码:
    <script> SyntaxHighlighter.all();
    </script>
大家可以看看,把phpcms自带的编辑器换成kindeditor

(责任编辑:网页模板)
相关热词搜索: kindeditor代码高亮 ueditor代码高亮