js创建ue编辑器编辑后台
来源:互联网 发布:linux shell 创建文件 编辑:程序博客网 时间:2024/04/30 01:40
<meta charset="utf-8">
<title>关于我们</title>
<link rel="stylesheet" type="text/css"
href="<%=path%>/static/commons/plugins/bootstrap-validator/css/bootstrapValidator.min.css">
<script type="text/javascript" charset="utf-8"
src="<%=path%>/static/commons/plugins/ueditor1_4_3_3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8"
src="<%=path%>/static/commons/plugins/ueditor1_4_3_3/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8"
src="<%=path%>/static/commons/plugins/ueditor1_4_3_3/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript"
src="<%=path%>/static/commons/plugins/bootstrap-validator/js/bootstrapValidator.min.js"></script>
<script type="text/javascript"
src="<%=path%>/static/commons/plugins/bootstrap-validator/js/zh_CN.js"></script>
<style type="text/css">
</style>
</head>
<!-- 页面展示部分 -->
<div style="margin: 0px 10px 5px 10px;">
<form id="defaultForm" class="form-horizontal" >
<div class="form-group">
<label class="col-sm-2 control-label" for="newsTitle">标题</label>
<div class="col-sm-9">
<input id="newsTitle" name="newsTitle" type="text"
class="form-control" />
</div>
</div>
<div class="form-group">
<div class="col-sm-12">
<script id="newsContent" name="newsContent" type="text/plain" style="width:100%;height:500px;"></script>
</div>
</div>
</form>
<br>
<button id="updateButton" type="button" class="btn btn-primary btn-lg" >修改</button>
</div>
</div>
<!-- js代码 -->
<script type="text/javascript">
$(function () {
//表单验证
var initBootstrapValidator = function () {
$("#defaultForm").bootstrapValidator({
message: 'This value is not valid',
feedbackIcons: {/*输入框不同状态,显示图片的样式*/
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'icon-loading'
},
fields: {
newsTitle: {
validators: {
notEmpty: {
message: '请填写新闻标题'
},
stringLength: {
min: 1,
max: 15,
message: '长度在1~15字符'
}
}
}
}
});
}
initBootstrapValidator();
//实例化编辑器
//建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,直接调用UE.getEditor('editor')就能拿到相关的实例
var ue = UE.getEditor('newsContent',{
toolbars: [[
'fullscreen', 'source',
'|', 'undo', 'redo',
'|', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', /* 'autotypeset', */'blockquote', 'pasteplain',
'|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc',
'|', 'rowspacingtop', 'rowspacingbottom', 'lineheight',
'|', 'customstyle', 'paragraph', 'fontfamily', 'fontsize',
'|', 'directionalityltr', 'directionalityrtl', 'indent',
'|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify',
'|', 'touppercase', 'tolowercase',
'|', 'link', 'unlink', 'anchor',
'|', 'imagenone', 'imageleft', 'imageright', 'imagecenter',
'|', 'simpleupload', 'insertimage', 'emotion', 'scrawl', 'insertvideo', 'music', 'attachment', /*'map', 'gmap', */'insertframe', 'insertcode', /*'webapp',*/ 'pagebreak', 'template', 'background',
'|', 'horizontal', 'date', 'time', 'spechars', 'snapscreen', 'wordimage',
'|', 'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', 'charts',
'|', 'print', 'preview', 'searchreplace', 'drafts', 'help'
]]
});
var newsId = "";
function showAboutUs() {
$.ajax({
type: 'POST',
url : "<%=path%>/queryDetails.do", //跳转查询数据的方法
data:{
type : 3
},
dataType:'json',
success:function(data){
$("#newsTitle").val(data.title);
newsId = data.id;
ue.ready(function(){
ue.setContent(data.newsContent);//设置标题
});
},
error:function(data){
alert("error1");
}
});
}
showAboutUs();
//发布新的信息(修改)
function update(buttonName, path) {
var bootstrapValidator = $("#defaultForm").data('bootstrapValidator');
bootstrapValidator.validate();
if(!bootstrapValidator.isValid()){
var speed=200;//滑动的速度
$('body,html').animate({ scrollTop: 0 }, speed);
return;
}
var newsTitle = $("#newsTitle");
var newsContent = UE.getEditor('newsContent').getContent();
if(!newsContent) {
$.messager.alert('提示','请填写发布内容!','error');
return;
}
$.ajax({
type: 'POST',
url: '<%=path%>/updateone.do',
data:[
{"name" : "id", "value" : newsId},
{"name" : "type", "value" : 3},
{"name" : "title", "value" : newsTitle.val()},
{"name" : "newsContent", "value":newsContent}
],
/* {
id : newsId,
title : newsTitle,
newsContent : newsContent
}, */
dataType:'json',
success:function(data){
$.messager.alert('提示',data.message);
},
error:function(data){
alert("error");
}
});
}
//更新
$("#updateButton").click(function (){
update();
});
});
</script>
- js创建ue编辑器编辑后台
- node.js集成百度UE编辑器
- UE编辑器
- UE编辑小技巧.
- UE编辑文本
- UE编辑技巧
- UE 编辑器笔记
- UE编辑器图片上传
- FCKeditor编辑器使用。JS获取编辑…
- UE-行文-js-20141125
- UE-Alex-js-20141125
- UE-JS举例
- UE编辑器:复制粘贴出错
- UE编辑器去掉*.bak备份文件
- 文档中导入 UE编辑器
- UE编辑器加入鼠标右键
- UE百度编辑器的使用
- UE编辑器格式化java代码
- Java 练习计算圆周长和面积
- Linux 7.3 Tomcat 8 JDK8 启动卡住半天才能正常启动解决方案
- RHCS红帽集群套件
- 一位资深程序员大牛给予Java初学者的学习路线建议
- 解决composer下载yii2没有vendor文件夹问题
- js创建ue编辑器编辑后台
- keil代码连接地址修改
- 【深度学习】入门理解ResNet和他的小姨子们(三)---ResNeXt
- Map简单介绍
- tornado学习笔记
- 二叉查找树Java实现
- vue对比其他框架
- 快速排序实现以及优化
- Linux新手笔记之Linux文件和目录