当前位置:首页 > 行业动态 > 正文

如何在dedecms中成功整合百度编辑器Ueditor?

整合百度编辑器UEditor到DedeCMS中,需要替换DedeCMS的默认编辑器为UEditor,并调整相应的配置文件。

整合步骤详解

如何在dedecms中成功整合百度编辑器Ueditor?  第1张

步骤一:下载并解压Ueditor文件

需要到百度编辑器(Ueditor)的官方网站下载最新版的编辑器源码,下载完成后,将压缩包解压,并将文件夹名称修改为“ueditor”,然后将这个文件夹复制到DedeCMS根目录下的include文件夹中。

步骤二:修改DedeCMS配置文件

需要修改DedeCMS的配置文件以支持新的编辑器,具体操作如下:

1、打开文件:找到并打开网站根目录下的include/inc/inc_fun_funAdmin.php文件。

2、替换代码:在该文件中,找到如下代码:

“`php

if($GLOBALS[‘cfg_html_editor’]==’fck’)

“`

将其替换为:

“`php

else if($GLOBALS[‘cfg_html_editor’]==’ueditor’)

{

$fvalue = $fvalue==” ? ‘<p></p>’ : $fvalue;

$code = ‘<script type="text/javascript" charset="utf8" src="’.$GLOBALS[‘cfg_cmspath’].’/include/ueditor/editor_config.js"></script>

<script type="text/javascript" charset="utf8" src="’.$GLOBALS[‘cfg_cmspath’].’/include/ueditor/editor_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.’" >’.$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;

}

}

“`

步骤三:设置DedeCMS后台参数

完成上述修改后,进入DedeCMS的后台管理页面,依次点击“系统”>“系统基本参数”>“核心设置”,找到“HTML编辑器”选项,并将其设置为“ueditor”,确保这里的设置与之前在配置文件中的更改保持一致,包括大小写。

步骤四:配置Ueditor编辑器

最后一步是对Ueditor编辑器进行一些基本的配置,例如上传路径、图片尺寸限制等,这些通常通过修改config.js文件来实现。

1、打开文件:找到并打开include/ueditor/php/config.json文件。

2、修改路径:将该文件中所有/ueditor/php/upload(一共8处)修改为自定义的路径,例如uploads/bdimg/日期/文件名。

3、保存并退出:保存对config.json的修改,然后退出编辑器。

注意事项

确保按照正确的步骤进行操作,避免文件路径错误或配置不正确导致的问题。

定期更新DedeCMS和Ueditor编辑器的版本,以确保系统的安全性和稳定性。

如果在整合过程中遇到问题,可以参考DedeCMS官方论坛和Ueditor的官方文档寻求帮助。

相关问答FAQs

1、为什么整合到项目中图片无法上传?

可能原因包括上传页面有登录验证,但上传时没有添加SESSION信息,导致上传失败,解决方法是在上传页面增加SESSION参数。

2、整合后无法粘贴图片怎么办?

如果整合后无法粘贴图片,可以尝试检查是否在上传页面增加了SESSION参数,或者查看是否有其他配置项影响了图片的粘贴功能。

如何将百度编辑器(Ueditor)整合到DedeCMS中

前言

百度编辑器(Ueditor)是一款功能强大的在线富文本编辑器,支持所见即所得的编辑方式,DedeCMS(帝国CMS)是一款流行的内容管理系统,以下是如何将Ueditor整合到DedeCMS中的详细步骤。

整合步骤

1. 准备工作

下载Ueditor:从百度编辑器的官方网站下载最新版本的Ueditor。

准备DedeCMS:确保你的DedeCMS系统是最新版本,以便兼容性更好。

2. 添加Ueditor到DedeCMS

2.1. 上传Ueditor文件

1、将下载的Ueditor文件解压,并将解压后的ueditor文件夹上传到DedeCMS的根目录下。

2、确保Ueditor文件夹下的config、lang、thirdparty、thirdparty等目录结构保持不变。

2.2. 配置Ueditor

1、配置路径:在Ueditor的根目录下的config文件夹中,找到config.json文件。

2、打开config.json文件,根据以下内容进行配置:

{
    "toolbars": [[
        "source", "undo", "redo", "bold", "italic", "underline", "fontborder", "strikethrough", "superscript", "subscript", "removeformat", "formatmatch", "autotypeset", "blockquote", "pasteplain", "forecolor", "backcolor", "insertorderedlist", "insertunorderedlist", "selectall", "cleardoc", "inserttable", "insertparagraphbeforetable", "insertrow", "deleterow", "insertcol", "deletecol", "mergecells", "mergeright", "mergedown", "splittocells", "splittorows", "splittocols", "charts", "simpleupload", "insertimage", "insertvideo", "attachment", "map", "gmap", "insertframe", "insertcode", "create", "preview", "searchreplace", "highlight", "fullscreen", "directionalityltr", "directionalityrtl", "customstyle", "template", "pagebreak", "horizontal", "removeformat", "formatmatch", "autotypeset", "directionalityltr", "directionalityrtl", "indent", "insertparagraphbefore", "paragraph", "fontfamily", "fontsize", "createparagraph", "justifyleft", "justifycenter", "justifyright", "justifyjustify", "forecolor", "backcolor", "insertorderedlist", "insertunorderedlist", "selectall", "searchreplace", "autoheight", "preview", "inserttable", "deletetable", "insertparagraphbeforetable", "insertrow", "deleterow", "insertcol", "deletecol", "mergecells", "mergeright", "mergedown", "splittocells", "splittorows", "splittocols", "insertimage", "insertvideo", "attachment", "map", "gmap", "insertframe", "insertcode", "create", "preview", "searchreplace", "highlight", "fullscreen", "directionalityltr", "directionalityrtl", "customstyle", "template", "pagebreak", "horizontal", "removeformat", "formatmatch", "autotypeset", "directionalityltr", "directionalityrtl", "indent", "insertparagraphbefore", "paragraph", "fontfamily", "fontsize", "createparagraph", "justifyleft", "justifycenter", "justifyright", "justifyjustify", "forecolor", "backcolor", "insertorderedlist", "insertunorderedlist", "selectall", "searchreplace", "autoheight", "preview", "inserttable", "deletetable", "insertparagraphbeforetable", "insertrow", "deleterow", "insertcol", "deletecol", "mergecells", "mergeright", "mergedown", "splittocells", "splittorows", "splittocols", "insertimage", "insertvideo", "attachment", "map", "gmap", "insertframe", "insertcode", "create", "preview", "searchreplace", "highlight", "fullscreen", "directionalityltr", "directionalityrtl", "customstyle", "template", "pagebreak", "horizontal", "removeformat", "formatmatch", "autotypeset", "directionalityltr", "directionalityrtl", "indent", "insertparagraphbefore", "paragraph", "fontfamily", "fontsize", "createparagraph", "justifyleft", "justifycenter", "justifyright", "justifyjustify", "forecolor", "backcolor", "insertorderedlist", "insertunorderedlist", "selectall", "searchreplace", "autoheight", "preview", "inserttable", "deletetable", "insertparagraphbeforetable", "insertrow", "deleterow", "insertcol", "deletecol", "mergecells", "mergeright", "mergedown", "splittocells", "splittorows", "splittocols", "insertimage", "insertvideo", "attachment", "map", "gmap", "insertframe", "insertcode", "create", "preview", "searchreplace", "highlight", "fullscreen", "directionalityltr", "directionalityrtl", "customstyle", "template", "pagebreak", "horizontal", "removeformat", "formatmatch", "autotypeset", "directionalityltr", "directionalityrtl", "indent", "insertparagraphbefore", "paragraph", "fontfamily", "fontsize", "createparagraph", "justifyleft", "justifycenter", "justifyright", "justifyjustify", "forecolor", "backcolor", "insertorderedlist", "insertunorderedlist", "selectall", "searchreplace", "autoheight", "preview", "inserttable", "deletetable", "insertparagraphbeforetable", "insertrow", "deleterow", "insertcol", "deletecol", "mergecells", "mergeright", "mergedown", "splittocells", "splittorows", "splittocols", "insertimage", "insertvideo", "attachment", "map", "gmap", "insertframe", "insertcode", "create", "preview", "searchreplace", "highlight", "fullscreen", "directionalityltr", "directionalityrtl", "customstyle", "template", "pagebreak", "horizontal", "removeformat", "formatmatch", "autotypeset", "directionalityltr", "directionalityrtl", "indent", "insertparagraphbefore", "paragraph", "fontfamily", "fontsize", "createparagraph", "justifyleft", "justifycenter", "justifyright", "justifyjustify", "forecolor", "backcolor", "insertorderedlist", "insertunorderedlist", "selectall", "searchreplace", "autoheight", "preview", "inserttable", "deletetable", "insertparagraphbeforetable", "insertrow", "deleterow", "insertcol", "deletecol", "mergecells", "mergeright", "mergedown", "splittocells", "splittorows", "splittocols", "insertimage", "insertvideo", "attachment", "map", "gmap", "insertframe", "insertcode", "create", "preview", "searchreplace", "highlight", "fullscreen", "directionalityltr", "directionalityrtl", "customstyle", "template", "pagebreak", "horizontal", "removeformat", "formatmatch", "autotypeset", "directionalityltr", "directionalityrtl", "indent", "insertparagraphbefore", "paragraph", "fontfamily", "fontsize", "createparagraph", "justifyleft", "justifycenter", "justifyright", "justifyjustify", "forecolor", "backcolor", "insertorderedlist", "insertunorderedlist", "selectall", "searchreplace", "autoheight", "preview", "inserttable", "deletetable", "insertparagraphbeforetable", "insertrow", "deleterow", "insertcol", "deletecol", "mergecells", "mergeright", "mergedown", "splittocells", "splittorows", "splittocols", "insertimage", "insertvideo", "attachment", "map", "gmap", "insertframe", "insertcode", "create", "preview", "searchreplace", "highlight", "fullscreen", "directionalityltr", "directionalityrtl", "customstyle", "template", "pagebreak", "horizontal", "removeformat", "formatmatch", "autotypeset", "directionalityltr", "directionalityrtl", "indent", "insertparagraphbefore", "paragraph", "fontfamily", "fontsize", "createparagraph", "justifyleft", "justifycenter", "justifyright", "justifyjustify", "forecolor", "backcolor", "insertorderedlist", "insertunorderedlist", "selectall", "searchreplace", "autoheight", "preview", "inserttable", "deletetable", "insertparagraphbeforetable", "insertrow", "deleterow", "insertcol", "deletecol", "mergecells", "mergeright", "merged
0