百度编辑器ueditor使用

版权声明:原创文章转载请注明来源 https://blog.csdn.net/LQZ8888/article/details/90703448

百度编辑器ueditor使用 

引入步骤:

  1. ueditor放到相应目录

比如\blog\Public\admin

2、页面head中加入js

   <script type="text/javascript" charset="utf-8" src="ueditor.config.js"></script>
   <script type="text/javascript" charset="utf-8" src="ueditor.all.min.js"> </script>

   <!--建议手动加载语言,避免在ie下有时因为加载语言失败导致编辑器加载失败-->

   <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型,比如你在配置项目里配置的是英文,这里加载的中文,那最后就是中文-->

   <script type="text/javascript" charset="utf-8" src="lang/zh-cn/zh-cn.js"></script>

3、定义多行文本框

   <textarea name="content" id="content" class="common-textarea" cols="30" style="width: 98%;" rows="10"></textarea>

4、 //实例化编辑器

//建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,直接调用UE.getEditor('editor')就能拿到相关的实例

<script>

var ue = UE.getEditor('content');

</script>

注意3步的id 和 getEditor()中的参数一致。

其它要求:

  1. 自定义菜单

  参考:ueditor.config.js

  1. 上传文件路径查看和设置

参考config.json
php/config.json中  imagePathFormat

 

    "imageUrlPrefix": "http://img1.blog.month4.com", /* 图片访问路径前缀 */

"imagePathFormat": "/Public/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}",    /* 上传保存路径,可以自定义保存路径和文件名格式 */

猜你喜欢

转载自blog.csdn.net/LQZ8888/article/details/90703448
今日推荐