dedecms更换html编辑器为ueditor

网上试了好多代码,终于找到这一段成功了,留存一下:

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
else if($GLOBALS['cfg_html_editor']=='ueditor')
{
$fvalue = $fvalue=='' ? '<p></p>' : $fvalue;
$code = '<script type="text/javascript" charset="utf-8" src="'.$GLOBALS['cfg_cmspath'].'/include/ueditor/ueditor.config.js"></script>';
$code .= '<script type="text/javascript" charset="utf-8" src="'.$GLOBALS['cfg_cmspath'].'/include/ueditor/ueditor.all.min.js"></script>';
$code .= '<link rel="stylesheet" type="text/css" href="'.$GLOBALS['cfg_cmspath'].'/include/ueditor/themes/default/css/ueditor.css"/>';
//$code .= '<textarea name="'.$fname.'" id="'.$fname.'" style="width:100%;">'.$fvalue.'</textarea>';
$code .= '<script type="text/plain" name="'.$fname.'" id="'.$fname.'">'.$fvalue.'</script>';
if($bbcode)
{
$code .= '<script type="text/javascript">UE.getEditor("'.$fname.'",{toolbars:[["Source","|",
"bold", "italic", "underline","|","fontsize","forecolor","emotion","Undo", "Redo"]],initialFrameHeight:100});</script>';
}
else
{
$code .= '<script type="text/javascript">UE.getEditor("'.$fname.'",{initialFrameHeight:450});</script>';
}
if($gtype=="print")
{
echo $code;
}
else
{
return $code;
}
}//bd end

替换步骤也简单记录一下:

1、下载ueditor并改好名字放在dedecms的“include”目录;

2、修改include目录中“inc”目录里的“inc_fun_funAdmin.php”文件,找到“获取编辑器”段的函数“SpGetEditor”代码,在其“else”前添加如上代码;

3、进入dedecms后台→系统→系统基本参数→核心设置,修改html编辑器的名字为ueditor。

IT民工一枚,求各种打赏!