百度编辑器UEditor怎么在jsp中配置
1个回答
展开全部
<script type="text/javascript" src="js/ueditor1.2.6.1/ueditor.config.js"></script>
<script type="text/javascript" src="'js/ueditor1.2.6.1/ueditor.all.js"></script>
引入上面这两个js ,下面一个css
<link rel="stylesheet" type="text/css" href="js/ueditor1.2.6.1/themes/default/css/ueditor.css'/>">
引入jquery
<script src="/js/jquery.js"></script>
下面是初始化的一些参数,可以在config里面配置,也可以在页面自己配置
var contextPath="${pageContext.request.contextPath}";
var langPath=contextPath+"/js/ueditor1.2.6.1/lang/";
var jspPath=contextPath+"/admin/ueditorjsp";
var imageUrl=jspPath+"/imageUp.jsp"; //图片上传提交地址
var scrawlUrl=jspPath+"/scrawlUp.jsp"; //涂鸦上传地址
//附件上传配置区
var fileUrl=jspPath+"/fileUp.jsp"; //附件上传提交地址
//远程抓取配置区
var catcherUrl=jspPath+"/getRemoteImage.jsp"; //处理远程图片抓取的地址
//图片在线管理配置区
var imageManagerUrl=jspPath+"/imageManager.jsp"; //图片在线管理的处理地址
//屏幕截图配置区
var snapscreenHost= '127.0.0.1' ; //屏幕截图的server端文件所在的网站地址或者ip,请不要加http://
var snapscreenServerUrl= jspPath+"/imageUp.jsp"; //屏幕截图的server端保存程序,UEditor的范例代码为“URL +"server/upload/php/snapImgUp.php"”
//word转存配置区
var wordImageUrl=jspPath+"/imageUp.jsp" ; //word转存提交地址
//获取视频数据的地址
var getMovieUrl=jspPath+"/getMovie.jsp";
var imagePath='${fileViewUrl}';
var editorHomeUrl=contextPath+"/js/ueditor1.2.6.1/";
var initialStyle='body{font-size:14px;font-family:宋体;line-height:32px;}';
var localDomain=['${fileViewUrl}'];
$(function(){
editor = new UE.ui.Editor({
UEDITOR_HOME_URL : editorHomeUrl,
initialFrameHeight: 400,
enterTag:'p',
pasteplain:false,
initialStyle:initialStyle,
sourceEditorFirst:false,
autoFloatEnabled:false,
wordCount:false,
langPath:langPath,
imageUrl:imageUrl,
scrawlUrl:scrawlUrl,
fileUrl:fileUrl,
catcherUrl:catcherUrl,
localDomain:localDomain,
imageManagerUrl:imageManagerUrl,
snapscreenHost:snapscreenHost,
snapscreenServerUrl:snapscreenServerUrl,
wordImageUrl:wordImageUrl,
getMovieUrl:getMovieUrl,
scaleEnabled:true //高度不可改变,内容太多会出现滚动条
});
editor.render('articleContent');//里面是要渲染的元素id
})
<script type="text/javascript" src="'js/ueditor1.2.6.1/ueditor.all.js"></script>
引入上面这两个js ,下面一个css
<link rel="stylesheet" type="text/css" href="js/ueditor1.2.6.1/themes/default/css/ueditor.css'/>">
引入jquery
<script src="/js/jquery.js"></script>
下面是初始化的一些参数,可以在config里面配置,也可以在页面自己配置
var contextPath="${pageContext.request.contextPath}";
var langPath=contextPath+"/js/ueditor1.2.6.1/lang/";
var jspPath=contextPath+"/admin/ueditorjsp";
var imageUrl=jspPath+"/imageUp.jsp"; //图片上传提交地址
var scrawlUrl=jspPath+"/scrawlUp.jsp"; //涂鸦上传地址
//附件上传配置区
var fileUrl=jspPath+"/fileUp.jsp"; //附件上传提交地址
//远程抓取配置区
var catcherUrl=jspPath+"/getRemoteImage.jsp"; //处理远程图片抓取的地址
//图片在线管理配置区
var imageManagerUrl=jspPath+"/imageManager.jsp"; //图片在线管理的处理地址
//屏幕截图配置区
var snapscreenHost= '127.0.0.1' ; //屏幕截图的server端文件所在的网站地址或者ip,请不要加http://
var snapscreenServerUrl= jspPath+"/imageUp.jsp"; //屏幕截图的server端保存程序,UEditor的范例代码为“URL +"server/upload/php/snapImgUp.php"”
//word转存配置区
var wordImageUrl=jspPath+"/imageUp.jsp" ; //word转存提交地址
//获取视频数据的地址
var getMovieUrl=jspPath+"/getMovie.jsp";
var imagePath='${fileViewUrl}';
var editorHomeUrl=contextPath+"/js/ueditor1.2.6.1/";
var initialStyle='body{font-size:14px;font-family:宋体;line-height:32px;}';
var localDomain=['${fileViewUrl}'];
$(function(){
editor = new UE.ui.Editor({
UEDITOR_HOME_URL : editorHomeUrl,
initialFrameHeight: 400,
enterTag:'p',
pasteplain:false,
initialStyle:initialStyle,
sourceEditorFirst:false,
autoFloatEnabled:false,
wordCount:false,
langPath:langPath,
imageUrl:imageUrl,
scrawlUrl:scrawlUrl,
fileUrl:fileUrl,
catcherUrl:catcherUrl,
localDomain:localDomain,
imageManagerUrl:imageManagerUrl,
snapscreenHost:snapscreenHost,
snapscreenServerUrl:snapscreenServerUrl,
wordImageUrl:wordImageUrl,
getMovieUrl:getMovieUrl,
scaleEnabled:true //高度不可改变,内容太多会出现滚动条
});
editor.render('articleContent');//里面是要渲染的元素id
})
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询