0%

kindeditor-4.1.5编辑器整合

kindeditor-4.1.5编辑器整合

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
kindeditor-4.1.5编辑器整合Syntaxhighlighter代码高亮
我使用的是kindeditor-4.1.5版本
链接地址:http://kindeditor.googlecode.com/files/kindeditor-4.1.5.zip
Syntaxhighlighter 代码高亮提示插件 网上就可以搜到

步骤:

1。找到kindeditor的code插件的code.js文件(在editor/plugins/code下)查找一下两行后删除或者注释掉

cls = type === "" ? "" : " lang-" + type,
html = "<pre class="prettyprint" + cls + "">
" + K.escape(code) + "</pre> ";

修改为:

cls = type === "" ? "" : type,
html = "<pre class="brush:" + cls + "">
" + K.escape(code) + "</pre> ";

在到 kindeditorphpcode目录下找到 demo.php
打开插入一下代码,如果没有你需要的语言你可以到syntaxhighlighter/scripts/这个目录下查找你需要的语言加入即可

<script type="text/javascript" src="../syntaxhighlighter/scripts/shCore.js"></script>
<script type="text/javascript" src="../syntaxhighlighter/scripts/shBrushPhp.js"></script>
<script type="text/javascript" src="../syntaxhighlighter/scripts/shBrushJScript.js"></script>
<script type="text/javascript" src="../syntaxhighlighter/scripts/shBrushCss.js"></script>
<script type="text/javascript" src="../syntaxhighlighter/scripts/shBrushSql.js"></script>
<script type="text/javascript" src="../syntaxhighlighter/scripts/shBrushXml.js"></script>
<link type="text/css" rel="stylesheet" href="../syntaxhighlighter/styles/shCoreDefault.css"/>

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!