欢迎来到飞鸟慕鱼博客,开始您的技术之旅!
当前位置: 首页前端设计正文

百度编辑器UEditor常用设置函数大全

墨初 前端设计 8920阅读

这段时间一直在改版墨初用户中心,本来想在墨初用户中心集成layui的编辑器,后来经过和几个用户中心插件用户的探讨,决定还是用百度的UEditor富文本编辑器,虽然说百度的UEditor富文本编辑器在功能上是很多,也很实用,但为了防止网站被入侵,后期会简化百度的UEditor富文本编辑器的部份功能。

今天我们说一说关于百度的UEditor富文本编辑器的一些常用设置和调用方法

百度UEditor富文本编辑器,UEditor使用方法,UEditor调用方法,UEditor设置命令

UEditor富文本编辑器部份常用的调用方法

实例化UEditor代码

代码1
UE.getEditor('editor', {initialFrameWidth:"100%" //初始化选项也可以加入其它参数})
代码2
UE.getEditor('editor')

删除UEditor编辑器

UE.getEditor('editor').destroy();

设置UEditor的焦点

UE.getEditor('editor').focus();

获取UEditor编辑器内容

UE.getEditor('editor').getContent()

编辑器UEditor是否有内容

UE.getEditor('editor').hasContents()

获取UEditor编辑器中内容纯文本格式

UE.getEditor('editor').getContentTxt()

获取UEditor编辑器中带格式的纯文本

UE.getEditor('editor').getPlainTxt()

启用UEditor编辑器

UE.getEditor('editor').setEnabled();

禁止UEditor编辑器

UE.getEditor('editor').setDisabled('fullscreen');

获取UEditor编辑器中整个html内容

UE.getEditor('editor').getAllHtml()

百度UEditor富文本编辑器,UEditor使用方法,UEditor调用方法,UEditor设置命令

百度UEditor富文本编辑器示意图

UEditor富文本编辑器部份常设置

fileUrl:UEDITOR_HOME_URL + "../yunserver/yunFileUp.php",//文件上传接口
filePath:"http://",
catcherUrl:UEDITOR_HOME_URL + "php/getRemoteImage.php",//获取远程图片接口
catcherPath:UEDITOR_HOME_URL + "php/",
imageManagerUrl:UEDITOR_HOME_URL + "../yunserver/yunImgManage.php",//图片管理接口
imageManagerPath:"http://",
snapscreenHost:'ueditor.baidu.com',
snapscreenServerUrl:UEDITOR_HOME_URL + "../yunserver/yunSnapImgUp.php",//截图接口
snapscreenPath:"http://",
wordImageUrl:UEDITOR_HOME_URL + "../yunserver/yunImageUp.php",//word图片转存接口
wordImagePath:"http://", //
getMovieUrl:UEDITOR_HOME_URL + "../yunserver/getMovie.php",//获取视频接口
lang:/^zh/.test(navigator.language || navigator.browserLanguage || navigator.userLanguage) ? 'zh-cn' : 'en',
langPath:UEDITOR_HOME_URL + "lang/",
webAppKey:"9HrmGf2ul4mlyK8ktO2Ziayd",
initialFrameWidth:860, //初始化宽度
initialFrameHeight:420, //初始化高度
focus:true //是否焦点

百度UEditor富文本编辑器,UEditor使用方法,UEditor调用方法,UEditor设置命令

简化后的百度UEditor富文本编辑器示意图

以上只是简单的对百度UEditor编辑器的调用以及设置做了一些介绍,更详细的百度UEditor编辑器使用方法请参考官方文档。

标签:
声明:无特别说明,转载请标明本文来源!