DWZ(J-UI)整合百度编辑器(UEditor)

本文档介绍了如何在DWZ(J-UI)框架中整合百度的富文本编辑器UEditor,包括引入必要的CSS和JS文件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

首先,在dwz.ui.js中找到
if($.fn.xheditor){
$("textarea.editor",$p).each(function(){
var $this=$(this);
var op={html5Upload:false,skin:'vista',tools:$this.attr("tools")||'full'};
var upAttrs=[["upLinkUrl","upLinkExt","zip,rar,txt"],["upImgUrl","upImgExt","jpg,jpeg,gif,png"],["upFlashUrl","upFlashExt","swf"],["upMediaUrl","upMediaExt","avi"]];
$(upAttrs).each(function(i){
var urlAttr=upAttrs[i][0];
var extAttr=upAttrs[i][1];
if($this.attr(urlAttr)){
op[urlAttr]=$this.attr(urlAttr);
op[extAttr]=$this.attr(extAttr)||upAttrs[i][2];}});
$this.xheditor(op);});}
注释掉,然后添加以下代码
//百度编辑器
if ($("textarea.editor", $p).length>0) {
	var module = $("textarea.editor", $p).attr('module');
	ueditor_loader[module]={};
	$("textarea.editor", $p).each(function(i){
		var $this = $(this);
		var module=$this.attr('module');
		var thisid= module+'_'+i;
		$this.attr('id',thisid);
		var uplink=$this.attr('upLink');
		var session=$this.attr('session');
		var ifheight=$this.attr('height')?$this.attr('height'):320;
		//var thisname=$this.attr('name');
		ueditor_loader[module][i]= new baidu.editor.ui.Editor({
			minFrameHeight:ifheight
			,imageUrl:uplink+'image_upload'
			//,snapscreenServerUrl:uplink+'image_upload'
			,fileUrl:uplink+'file_upload?'+session
			,catcherUrl:uplink+'get_remote_image'
			,imageManagerUrl:uplink+'image_manager'
			,wordImageUrl:uplink+'image_upload'
			,getMovieUrl:uplink+'get_movie'
			//,textarea:thisname
		});
		ueditor_loader[module][i].render( $this[0] );
	});
}
//百度编辑器
在首页文件index.html中加入以下代码
<script type="text/javascript">
var UEDITOR_HOME_URL='__PUBLIC__/ueditor/',ueditor_loader={};
//编辑器同步
function editorSyn(ename){
$.each(ueditor_loader[ename],function(i){
this.sync(); 
});
}
</script>

然后引入ueditor.min.css、ueditor.config.js和ueditor.all.min.js

<link rel="stylesheet" type="text/css" href="__PUBLIC__/ueditor/themes/default/css/ueditor.min.css"/> 
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/ueditor/ueditor.config.js"></script> 
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/ueditor/ueditor.all.min.js"></script>
然后在百度编辑器就可以使用了



评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值