百度编辑器使用笔记

1、编辑器配置

var ue = UE.getEditor('editor-container', {
toolbars: [
['undo', 'redo','|','bold','italic','underline','strikethrough','forecolor','|','lineheight','fontsize','fontfamily','insertcode'],
['justifyleft','justifyright','justifycenter','justifyjustify','|','insertorderedlist','insertunorderedlist','|','blockquote','horizontal',
'removeformat','formatmatch','|','link','insertimage','insertvideo',]
],
autoHeightEnabled: true,//自动加高
autoFloatEnabled: true,//自动浮动
topOffset:32,//浮动时工具栏距离浏览器顶部的高度
elementPathEnabled : false, //是否启用元素路径,默认是true显示
wordCount:false ,//是否开启字数统计
allowDivTransToP: false,//阻止div标签自动转换为p标签
catchRemoteImageEnable:false,//抓取远程图片是否开启,默认true
});

2、设置默认

ue.ready(function(){
	ue.execCommand('fontfamily','arial');   //字体
	ue.execCommand('lineheight', 1);          //行间距
	ue.execCommand('fontsize', '16px');       //字号
});

3、UEditor编辑器如何关闭抓取远程图片本地化功能

  问题:直接复制粘贴内容的时候,编辑器会默认将图片本地化并返回本地化的src

  解决方法:catchRemoteImageEnable:false,//抓取远程图片是否开启,默认true

4、一个优秀的二次开发编辑器https://github.com/FaeryQuest/wxEditor

  

posted @ 2021-04-13 15:11  漫天风沙  阅读(130)  评论(0编辑  收藏  举报