
UEditor是由百度「FEX前端研发团队」开发的所见即所得富文本web编辑器,具有轻量,可定制,注重用户体验等特点,开源基于MIT协议,允许自由使用和修改代码。下面就介绍DedeCms编辑器更换百度编辑器ueditor的方法。
1、下载百度ueditor编辑器
可以在搜索引擎搜索“百度ueditor”去官方下载编辑器源码。也可以直接复制url:http://ueditor.baidu.com/website/进入官网。
2、安装百度ueditor编辑器
在include目录下新建一个“ueditor”文件夹,将从官网下载压缩包解压并上传至“ueditor”文件夹内。
3、修改配置文件
找到include/inc/下的inc_func_funcAdmin.php文件,在判断编辑器部分,如下
if($GLOBALS[‘cfg_html_editor’]==’fck’)
在它后面大概367行添加如下判断
else if($GLOBALS[‘cfg_html_editor’]==’ueditor’) { $fvalue = $fvalue==” ? ‘<p></p>’ : $fvalue; $code = ‘<script type=”text/javascript” charset=”utf-8″ src=”/include/ueditor/ueditor.config.js”></script> <script type=”text/javascript” charset=”utf-8″ src=”/include/ueditor/ueditor.all.js”></script> <link rel=”stylesheet” type=”text/css” href=”/include/ueditor/themes/default/css/ueditor.css”/> <textarea name=”‘.$fname.'” id=”‘.$fname.'” style=”width:100%;”>’.$fvalue.'</textarea> <script type=”text/javascript”>var ue = new baidu.editor.ui.Editor();ue.render(“‘.$fname.'”);</script>’; if($gtype==”print”) { echo $code; } else { return $code; } }
4、修改网站后台系统配置
进入后台,在>系统>系统基本参数>核心设置>将“Html编辑器”改为“ueditor”,然后保存即可。