织梦后台粘贴图片,把默认编辑器换成百度ueditor

1.下载ueditor编辑器,解压文件http://ueditor.baidu.com/website/download.html#ueditor ,找对应编码版本
在这里插入图片描述
2. 把解压的ueditor文件放到dede根目录 include文件夹下,命名为 ueditor
3. 找到include\inc\inc_fun_funAdmin.php文件,找到 161行左右的代码:if($GLOBALS[‘cfg_html_editor’]==‘fck’) 把这一句代码替换为:

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>
	<script type="text/javascript" charset="utf-8" src="'.$GLOBALS['cfg_cmspath'].'/include/ueditor/ueditor.all.js"></script>
	<link rel="stylesheet" type="text/css" href="'.$GLOBALS['cfg_cmspath'].'/include/ueditor/themes/default/css/ueditor.css"/>
	<textarea name="'.$fname.'" id="'.$fname.'" style="width:100%;">'.$fvalue.'</textarea>
	<script type="text/javascript"> var ue = UE.getEditor("'.$fname.'");</script>';
	if($gtype=="print")
	{
	echo $code;
	}
	else
	{
	return $code;
	}
	}
elseif($GLOBALS['cfg_html_editor']=='fck')

4.修改ueditor上传文件的路径

一:修改 include\ueditor\php\config.json 配置文件,(其实这一步也可以省略,虽然不影响使用,但是我们在添加文章时目录会生成一些新的目录) 原始文件都是类似这样的:/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}意思就上传时会保存在跟目录下生成这样的目录格式.

二:.我们需要把它修改为dedecms默认的图片文件存放地址 uploads 下,命名规则可以如下: /uploads/image/{yyyy}{mm}{dd}/{time}{rand:6}
当然你们也可以修改为你们自己想要的目录格式。
比如:
/ueditor/php/upload/image/
/ueditor/php/upload/video/
/ueditor/php/upload/file/

修改成自己路径,如:
/uploads/allimg/
/uploads/video/
/uploads/file/

5、dedecms后台中的:系统 - 系统基本参数 - 核心设置 - Html编辑器(ckeditor,需要fck的用户可以去官网下载): ueditor

如果后台发布一篇超长的文章,想编辑器的高度自动延伸的话,需要修改配置文件, include\ueditor\ueditor.config.js 文件 打开这几行的注释:

//,autoHeightEnabled:true

//,scaleEnabled:false

//,minFrameWidth:800 //编辑器拖动时最小宽度,默认800

//,minFrameHeight:220 //编辑器拖动时最小高度,默认220

initialFrameWidth :800,//设置编辑器宽度,把宽高改为你想要的即可。

initialFrameHeight:250,//设置编辑器高度,把宽高改为你想要的即可。

相关资源包:《织梦搭配百度ueditor编辑器.rar

发布了102 篇原创文章 · 获赞 14 · 访问量 13万+

猜你喜欢

转载自blog.csdn.net/fofu33/article/details/103958136