Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_14980201
ueditor
提交
b53f44b5
U
ueditor
项目概览
qq_14980201
/
ueditor
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
ueditor
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b53f44b5
编写于
4月 29, 2013
作者:
C
campaign
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
by zhanyi
上级
0332e652
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
34 addition
and
38 deletion
+34
-38
_examples/submitFormDemo.html
_examples/submitFormDemo.html
+12
-19
_src/core/Editor.js
_src/core/Editor.js
+16
-11
jsp/getContent.jsp
jsp/getContent.jsp
+3
-4
net/getContent.ashx
net/getContent.ashx
+3
-4
未找到文件。
_examples/submitFormDemo.html
浏览文件 @
b53f44b5
...
...
@@ -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/
)){
form
1
.
action
=
form
.
action
=
"
../php/getContent.php
"
;
form
.
action
=
"
../php/getContent.php
"
;
}
else
if
(
version
.
match
(
/net/
)){
form
1
.
action
=
form
.
action
=
"
../net/getContent.ashx
"
;
form
.
action
=
"
../net/getContent.ashx
"
;
}
else
if
(
version
.
match
(
/jsp/
)){
form
1
.
action
=
form
.
action
=
"
../jsp/getContent.jsp
"
;
form
.
action
=
"
../jsp/getContent.jsp
"
;
}
//-----
</script>
</body>
...
...
_src/core/Editor.js
浏览文件 @
b53f44b5
...
...
@@ -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
);
}
},
/**
...
...
jsp/getContent.jsp
浏览文件 @
b53f44b5
<%@ 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=
"../u
editor.
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:
500
px
;
height:
300
px
;
'>
"+content1+"
</
textarea
>
<
br
/
>"
);
%>
\ No newline at end of file
net/getContent.ashx
浏览文件 @
b53f44b5
...
...
@@ -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='../u
editor.
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录