Typecho集成ueditor笔记

前言:萝卜青菜各有所爱,因为个人需求所以需要在博客中集成ueditor,并非是我不喜欢md语法 其实本篇的笔记的书写最早也是在本地的md编辑器上完成的
1. 首先下载ueditor编辑器,然后重命名文件为ueditor,将文件夹复制到admin目录
2. 打开admin目录的editor-js.php文件 在文件末尾处
    </script>
<?php endif;?>
之间插入以下代码
    <?php else:?>
<!--不开启markdown时使用ueditor-->

<!-- 配置文件 -->
<script type="text/javascript" src="./ueditor/ueditor.config.js"></script>

<!-- 编辑器源码文件 -->
<script type="text/javascript" src="./ueditor/ueditor.all.min.js"></script>

<!-- 语言包文件(建议手动加在语言,避免在ie下有时因为加载语言失败导致编辑器加载失败) -->
<script type="text/javascript" src="./ueditor/lang/zh-cn/zh-cn.js"></script>


<script type="text/javascript">
var editor = UE.getEditor('text')
</script>
3. 打开 varTypechoCommonParagraph.php文件注释掉152行的
    $text = Typecho_Common::lockHTML($text);
此处是否会对原有功能产生bug未知,如果不注释掉 会对ue编辑器的部分代码高亮功能产生显示bug
 

4. 打开模版文件夹的footer.php 这里我使用的是默认模版 所以路径是usr hemesdefault 在

    <?php $this->footer(); ?>
的下面插入
    <script type="text/javascript" src="<?php $this->options->siteUrl(); ?>admin/ueditor/third-party/SyntaxHighlighter/shCore.js"></script>
<link rel="stylesheet" href="<?php $this->options->siteUrl(); ?>admin/ueditor/third-party/SyntaxHighlighter/shCoreDefault.css" type="text/css" />
<script>
SyntaxHighlighter.all() //执行代码高亮
</script>
5.在ueditor hird-partySyntaxHighlighter 下的shCore.js中搜索
    textarea.appendChild(document.createTextNode(code));
在后面添加一句
    textarea.style.height = "100%";
此处是为了修正代码高亮时 双击代码全选出错的BUG,新版的SyntaxHighlighter插件中已经默认双击代码全选,去掉了以前的flash复制功能
关闭所有文件保存,并在个人设置页面关闭markdown语法编辑选项。目前还没仔细测试是否有BUG,也没去调整图片上传的功能。 所以对于本文的修改内容请慎重使用。
原文地址:https://www.cnblogs.com/toumingbai/p/3778506.html