提交 b53f44b5 编写于 作者: C campaign

by zhanyi

上级 0332e652
......@@ -24,39 +24,32 @@
<script type="text/plain" id="myEditor" name="myEditor">
<p>欢迎使用UEditor</p>
</script>
<input type="submit" value="Form内部可以直接提交">
<input type="submit" value="通过input的submit提交">
</form>
<button onclick="document.getElementById('form').submit()">Form外部直接提交会失败</button>
<input type="button" value="先点我一下同步内容,左边的哥们才能生效" onclick="editor_a.sync()" />
<p>
从1.2.6开始,会自动同步数据无需再手动调用sync方法
<button onclick="document.getElementById('form').submit()">通过js调用submit提交</button>
<p>=====================================华丽的分隔线=====================================</p>
<form id="form1" method="post" target="_blank">
<textarea id="myEditor1" name="myEditor1">这里的内容将会和html,body等标签一块提交</textarea>
</form>
<button onclick="document.getElementById('form1').submit()">Form外部提交</button>
</p>
<script type="text/javascript">
var editor_a = UE.getEditor('myEditor');
var editor_a1 = UE.getEditor('myEditor1',{
allHtmlEnabled:true
});
var editor_a = UE.getEditor('myEditor',{initialFrameHeight:500});
//--自动切换提交地址----
var doc=document,
version=editor_a.options.imageUrl||"php",
form=doc.getElementById("form"),
form1=doc.getElementById("form1");
form=doc.getElementById("form");
if(version.match(/php/)){
form1.action=form.action="../php/getContent.php";
form.action="../php/getContent.php";
}else if(version.match(/net/)){
form1.action=form.action="../net/getContent.ashx";
form.action="../net/getContent.ashx";
}else if(version.match(/jsp/)){
form1.action=form.action="../jsp/getContent.jsp";
form.action="../jsp/getContent.jsp";
}
//-----
</script>
</body>
......
......@@ -262,20 +262,10 @@
geckoSel.removeAllRanges();
}
this._initEvents();
if (options.initialContent) {
if (options.autoClearinitialContent) {
var oldExecCommand = me.execCommand;
me.execCommand = function () {
me.fireEvent('firstBeforeExecCommand');
return oldExecCommand.apply(me, arguments);
};
this._setDefaultContent(options.initialContent);
} else
this.setContent(options.initialContent, false, true);
}
//为form提交提供一个隐藏的textarea
for (var form = this.iframe.parentNode; !domUtils.isBody(form); form = form.parentNode) {
if (form.tagName == 'FORM') {
me.form = form;
if(me.options.autoSyncData){
domUtils.on(me.window,'blur',function(){
setValue(form,me);
......@@ -288,6 +278,18 @@
break;
}
}
if (options.initialContent) {
if (options.autoClearinitialContent) {
var oldExecCommand = me.execCommand;
me.execCommand = function () {
me.fireEvent('firstBeforeExecCommand');
return oldExecCommand.apply(me, arguments);
};
this._setDefaultContent(options.initialContent);
} else
this.setContent(options.initialContent, false, true);
}
//编辑器不能为空内容
if (domUtils.isEmptyNode(me.body)) {
me.body.innerHTML = '<p>' + (browser.ie ? '' : '<br/>') + '</p>';
......@@ -572,6 +574,9 @@
if (browser.gecko && (geckoSel = this.selection.getNative())) {
geckoSel.removeAllRanges();
}
if(me.options.autoSyncData){
setValue(me.form,me);
}
},
/**
......
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<script src="../uparse.js" type="text/javascript"></script>
<script src="../ueditor.parse.js" type="text/javascript"></script>
<script>
uParse('.content',{
'highlightJsUrl':'../third-party/SyntaxHighlighter/shCore.js',
......@@ -11,11 +11,10 @@
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
String content = request.getParameter("myEditor");
String content1 = request.getParameter("myEditor1");
response.getWriter().print("第1个编辑器的值");
response.getWriter().print("<div class='content'>"+content+"</div>");
response.getWriter().print("<br/>第2个编辑器的值<br/>");
response.getWriter().print("<textarea style='width:500px;height:300px;'>"+content1+"</textarea><br/>");
%>
\ No newline at end of file
......@@ -16,13 +16,13 @@ public class getContent : IHttpHandler {
//获取数据
string content = context.Server.HtmlEncode(context.Request.Form["myEditor"]);
string content1 = context.Server.HtmlEncode(context.Request.Form["myEditor1"]);
//存入数据库或者其他操作
//-------------
//显示
context.Response.Write("<script src='../uparse.js' type='text/javascript'></script>");
context.Response.Write("<script src='../ueditor.parse.js' type='text/javascript'></script>");
context.Response.Write(
"<script>uParse('.content',{"+
"'highlightJsUrl':'../third-party/SyntaxHighlighter/shCore.js',"+
......@@ -32,8 +32,7 @@ public class getContent : IHttpHandler {
context.Response.Write("第1个编辑器的值");
context.Response.Write("<div class='content'>" + context.Server.HtmlDecode(content) + "</div>");
context.Response.Write("<br/>第2个编辑器的值<br/>");
context.Response.Write("<textarea class='content' style='width:500px;height:300px;'>"+context.Server.HtmlDecode(content1)+"</textarea><br/>");
}
public bool IsReusable {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册