Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_14980201
ueditor
提交
d30e9b88
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,发现更多精彩内容 >>
提交
d30e9b88
编写于
10月 31, 2013
作者:
C
campaign
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/dev-1.3.0' into dev-1.3.0
上级
2c22575d
6573cbe5
变更
10
展开全部
隐藏空白更改
内联
并排
Showing
10 changed file
with
1092 addition
and
1168 deletion
+1092
-1168
_examples/backgroundDemo.html
_examples/backgroundDemo.html
+0
-73
_examples/index.html
_examples/index.html
+0
-4
_examples/uparsedemo.html
_examples/uparsedemo.html
+36
-0
_src/plugins/background.js
_src/plugins/background.js
+5
-2
_test/plugins/contextmenu.js
_test/plugins/contextmenu.js
+1032
-1031
_test/plugins/font.js
_test/plugins/font.js
+3
-0
_test/plugins/source.js
_test/plugins/source.js
+1
-1
_test/plugins/table.action.js
_test/plugins/table.action.js
+7
-54
_test/tools/br/js/run.js
_test/tools/br/js/run.js
+7
-3
dialogs/background/background.js
dialogs/background/background.js
+1
-0
未找到文件。
_examples/backgroundDemo.html
已删除
100644 → 0
浏览文件 @
2c22575d
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html;charset=utf-8"
/>
<script
src=
"../ueditor.parse.js"
type=
"text/javascript"
></script>
<script>
// 语法
// uParse(selector,[option])
/*
selector支持
id,class,tagName
*/
/*
目前支持的参数
option:
highlightJsUrl 代码高亮相关js的路径 如果展示有代码高亮,必须给定该属性
highlightCssUrl 代码高亮相关css的路径 如果展示有代码高亮,必须给定该属性
liiconpath 自定义列表样式的图标路径,可以不给定,默认'http://bs.baidu.com/listicon/',
listDefaultPaddingLeft : 自定义列表样式的左边宽度 默认'20',
customRule 可以传入你自己的处理规则函数,函数第一个参数是容器节点
*/
uParse
(
'
#content
'
,{
rootPath
:
'
../
'
})
</script>
<title>
背景颜色设置
</title>
</head>
<body>
<h1>
背景颜色设置演示
</h1>
设置完背景颜色之后,在内容最后有下面一段代码:
<pre>
<p
data-background=
"background-repeat:no-repeat;background-position:center center;background-color:#C3D69B;background-image:url(http://www.baidu.com/img/bdlogo.gif);"
>
<br/>
</p>
</pre>
<div
id=
"content"
class=
"content"
style=
"width:800px;"
>
<h1>
UEditor
</h1>
<h2>
简介
</h2>
<p>
UEditor是由百度WEB前端研发部开发的所见即所得的开源富文本编辑器,具有轻量、可定制、用户体验优秀等特点。开源基于BSD协议,所有源代码在协议允许范围内可自由修改和使用。百度UEditor的推出,可以帮助不少网站开者在开发富文本编辑器所遇到的难题,节约开发者因开发富文本编辑器所需要的大量时间,有效降低了企业的开发成本。
</p>
<h2>
特点
<br/>
</h2>
<p>
1、核心层提供了编辑器底层的一些方法和概念,如DOM树操作、Selection、Range等。
</p>
<p>
2、在核心层之上覆盖的是命令插件层。之所以叫命令插件层,是因为UEditor中所有的功能型实现都是通过这一层中的命令和插件来完成的,并且各个命令和插件之间基本互不耦合——使用者需要使用哪个功能就导入哪个功能对应的命令或者插件文件,完全不用考虑另外那些杂七杂八的JS文件(极少数插件除外,关于这些插件下文会整理出一个依赖列表来供同学们参考)。
</p>
<p>
理论上来讲,所有的命令都是可以用插件来代替的,但是依然将两者分开的主要原因是命令都是一些静态的方法,无需随editor实例初始化,从而优化了编辑器的性能。而插件随编辑器的初始化而初始化,性能上会有少许的影响,但相比命令而言,插件能够完成更加复杂的功能。其中最主要的一个特点是在插件内部既可以为编辑器注册命令,也可以为编辑器绑定监听事件。这个特点使得为编辑器添加任何功能都可以在插件中独立完成。
</p>
<p>
3、在命令插件层之上则是UI层。UEditor的UI设计与核心层和命令插件层几乎完全解耦,简单的几个配置就可以为编辑器在界面上添加额外的UI元素和功能,具体的配置下面将会深入阐述。
</p>
<p>
<br/>
</p>
<p
style=
"display:none;"
data-background=
"background-repeat:no-repeat;background-position:center center;background-color:#C3D69B;background-image:url(http://www.baidu.com/img/bdlogo.gif);"
>
<br/>
</p>
</div>
</body>
</html>
\ No newline at end of file
_examples/index.html
浏览文件 @
d30e9b88
...
...
@@ -61,10 +61,6 @@
<a
href=
"sectionDemo.html"
target=
"_self"
style=
"color:red"
>
new 目录大纲示例
</a><br/>
获取编辑内容的目录大纲,并通过操作目录,更新编辑器内容
</li>
<li>
<a
href=
"backgroundDemo.html"
target=
"_self"
style=
"color:red"
>
new 背景颜色设置
</a><br/>
设置编辑内容背景颜色,并在预览页显示背景颜色
</li>
<li>
<a
href=
"multiDemo.html"
target=
"_self"
>
多编辑器实例
</a><br/>
一个页面实例化多个编辑器,互不影响
...
...
_examples/uparsedemo.html
浏览文件 @
d30e9b88
...
...
@@ -25,6 +25,9 @@
uParse
(
'
.content
'
,{
rootPath
:
'
../
'
})
uParse
(
'
.content_background
'
,{
rootPath
:
'
../
'
})
</script>
<title></title>
</head>
...
...
@@ -157,6 +160,39 @@
</table>
</div>
<textarea
class=
"content"
>
asdfasdfasdfasdfasdfadsfa
</textarea>
<div
class=
"content_background"
>
<h1>
UEditor
</h1>
<h2>
简介
</h2>
<p>
UEditor是由百度WEB前端研发部开发的所见即所得的开源富文本编辑器,具有轻量、可定制、用户体验优秀等特点。开源基于BSD协议,所有源代码在协议允许范围内可自由修改和使用。百度UEditor的推出,可以帮助不少网站开者在开发富文本编辑器所遇到的难题,节约开发者因开发富文本编辑器所需要的大量时间,有效降低了企业的开发成本。
</p>
<h2>
特点
<br/>
</h2>
<p>
1、核心层提供了编辑器底层的一些方法和概念,如DOM树操作、Selection、Range等。
</p>
<p>
2、在核心层之上覆盖的是命令插件层。之所以叫命令插件层,是因为UEditor中所有的功能型实现都是通过这一层中的命令和插件来完成的,并且各个命令和插件之间基本互不耦合——使用者需要使用哪个功能就导入哪个功能对应的命令或者插件文件,完全不用考虑另外那些杂七杂八的JS文件(极少数插件除外,关于这些插件下文会整理出一个依赖列表来供同学们参考)。
</p>
<p>
理论上来讲,所有的命令都是可以用插件来代替的,但是依然将两者分开的主要原因是命令都是一些静态的方法,无需随editor实例初始化,从而优化了编辑器的性能。而插件随编辑器的初始化而初始化,性能上会有少许的影响,但相比命令而言,插件能够完成更加复杂的功能。其中最主要的一个特点是在插件内部既可以为编辑器注册命令,也可以为编辑器绑定监听事件。这个特点使得为编辑器添加任何功能都可以在插件中独立完成。
</p>
<p>
3、在命令插件层之上则是UI层。UEditor的UI设计与核心层和命令插件层几乎完全解耦,简单的几个配置就可以为编辑器在界面上添加额外的UI元素和功能,具体的配置下面将会深入阐述。
</p>
<p>
<br/>
</p>
<p
style=
"display:none;"
data-background=
"background-repeat:no-repeat;background-position:center center;background-color:#C3D69B;background-image:url(http://www.baidu.com/img/bdlogo.gif);"
>
<br/>
</p>
</div>
</body>
...
...
_src/plugins/background.js
浏览文件 @
d30e9b88
...
...
@@ -43,10 +43,12 @@ UE.plugin.register('background', function () {
}
html
+=
'
}</style>
'
;
headHtml
.
push
(
html
);
},
'
beforesetcontent
'
:
function
()
{
me
.
execCommand
(
'
background
'
,
{});
}
},
inputRule
:
function
(
root
)
{
me
.
execCommand
(
'
background
'
,
{});
utils
.
each
(
root
.
getNodesByTagName
(
'
p
'
),
function
(
p
)
{
var
styles
=
p
.
getAttr
(
'
data-background
'
);
if
(
styles
)
{
...
...
@@ -84,7 +86,8 @@ UE.plugin.register('background', function () {
ele
=
me
.
document
.
getElementById
(
cssRuleId
),
styles
=
(
ele
?
ele
.
innerHTML
:
''
).
match
(
/body
[\s]
*
\{(
.*
)\}
/
);
return
styles
?
stringToObj
(
styles
[
1
])
:
null
;
}
},
notNeedUndo
:
true
}
}
}
...
...
_test/plugins/contextmenu.js
浏览文件 @
d30e9b88
此差异已折叠。
点击以展开。
_test/plugins/font.js
浏览文件 @
d30e9b88
...
...
@@ -403,7 +403,9 @@ test('对表格中的文本添加颜色和下划线', function () {
ut
.
setSelected
(
range
);
setTimeout
(
function
()
{
editor
.
execCommand
(
'
underline
'
);
setTimeout
(
function
()
{
ua
.
checkHTMLSameStyle
(
'
<span style="color: rgb(255, 100, 100); text-decoration: underline; ">hello1</span>
'
,
editor
.
document
,
trs
[
0
].
firstChild
,
'
第一个单元格有下划线和前景色
'
);
equal
(
'
<span style="color: rgb(255, 100, 100); text-decoration: underline; ">hello1</span>
'
,
editor
.
document
,
trs
[
0
].
firstChild
,
'
第一个单元格有下划线和前景色
'
);
ua
.
checkHTMLSameStyle
(
'
<span style="color: rgb(255, 100, 100); ">hello2</span>
'
,
editor
.
document
,
trs
[
0
].
lastChild
,
'
第2个单元格有前景色
'
);
ua
.
checkHTMLSameStyle
(
'
<span style="color: rgb(255, 100, 100); ">hello3</span>
'
,
editor
.
document
,
trs
[
1
].
firstChild
,
'
第3个单元格有前景色
'
);
equal
(
trs
[
1
].
firstChild
.
getAttribute
(
'
colspan
'
),
2
,
'
colspan为2
'
);
...
...
@@ -412,6 +414,7 @@ test('对表格中的文本添加颜色和下划线', function () {
setTimeout
(
function
()
{
start
();
},
100
);
},
100
);
},
100
);
},
100
);
},
50
);
...
...
_test/plugins/source.js
浏览文件 @
d30e9b88
...
...
@@ -145,7 +145,7 @@ test('b,i标签,切换源码后自动转换成strong和em', function () {
equal
(
editor
.
getContent
(),
'
<p><strong>加粗的内容</strong><em>斜体的内容<strong>加粗且斜体</strong></em></p>
'
);
});
test
(
'
trace 1734 range的更新/特殊符号的转换
'
,
function
()
{
test
(
'
activ trace 3739
trace 1734 range的更新/特殊符号的转换
'
,
function
()
{
var
editor
=
te
.
obj
[
0
];
editor
.
setContent
(
'
<p>"<></p>
'
);
setTimeout
(
function
()
{
...
...
_test/plugins/table.action.js
浏览文件 @
d30e9b88
...
...
@@ -5,55 +5,8 @@
* Time: 下午4:40
* To change this template use File | Settings | File Templates.
*/
//test('trace 3047 ,3545 全屏插入表格', function () {
// if (ua.browser.gecko)return;//TODO 1.2.6
//// if (ua.browser.ie && ua.browser.ie < 9)return;//TODO 1.2.6
// var div = document.body.appendChild(document.createElement('div'));
// $(div).css('width', '500px').css('height', '500px').css('border', '1px solid #ccc');
// var editor = te.obj[2];
// editor.render(div);
// stop();
// editor.ready(function () {
// editor.setContent('<p></p>');
// editor.ui.setFullScreen(!editor.ui.isFullScreen());
// editor.execCommand('inserttable');
// var width1 = editor.body.getElementsByTagName('td')[0].width;
// setTimeout(function () {
// editor.ui.setFullScreen(!editor.ui.isFullScreen());
// setTimeout(function () {
// var width2 = editor.body.getElementsByTagName('td')[0].width;
// ok((width1 - width2) > 10, '页面宽度自适应');
// div.parentNode.removeChild(div);
// start();
// }, 500);
// }, 500);
// });
//});
//test('拖拽-最右边的单元格', function () {
// if (ua.browser.ie && ua.browser.ie < 8) return;
// var editor = te.obj[0];
// var range = te.obj[1];
// editor.setContent('<p></p>');
// range.setStart(editor.body.firstChild, 0).collapse(true).select();
// editor.execCommand('inserttable');
// ua.manualDeleteFillData(editor.body);
// var tds = te.obj[0].body.getElementsByTagName('td');
// var width1 = tds[4].width;
// ua.mousemove(tds[4], {clientX: 492, clientY: 21});
// ua.mousedown(tds[4], {clientX: 492, clientY: 21});
// setTimeout(function () {
// equal(editor.body.style.cursor, 'col-resize', '检查鼠标显示');
// ua.mousemove(tds[4], {clientX: 481, clientY: 21});
// ua.mouseup(tds[4], {clientX: 481, clientY: 21});
// setTimeout(function () {
// var width2 = te.obj[0].body.getElementsByTagName('td')[4].width;
// ok(width1 - width2 > 10, '拖拽后单元格宽度改变');
// start();
// }, 200);
// }, 20);
// stop();
//});
//
//test('', function () {
// stop()
//});
...
...
@@ -179,7 +132,7 @@ test('tableDragable-双击', function () {//tableClicked
var
tds
=
editor
.
body
.
getElementsByTagName
(
'
td
'
);
equal
(
selectedTds
.
length
,
9
,
'
全选
'
);
if
(
ua
.
browser
.
ie
&&
ua
.
browser
.
ie
<
9
)
ua
.
checkResult
(
editor
.
selection
.
getRange
(),
tds
[
0
].
firstChild
,
tds
[
0
].
firstChild
,
0
,
0
,
true
,
'
检查选中的range
'
)
ua
.
checkResult
(
editor
.
selection
.
getRange
(),
tds
[
0
].
firstChild
,
tds
[
0
].
firstChild
,
0
,
0
,
true
,
'
检查选中的range
'
)
;
else
ua
.
checkResult
(
editor
.
selection
.
getRange
(),
tds
[
0
],
tds
[
0
],
0
,
0
,
true
,
'
检查选中的range
'
);
setTimeout
(
function
()
{
...
...
@@ -188,9 +141,9 @@ test('tableDragable-双击', function () {//tableClicked
te
.
dom
.
push
(
document
.
getElementById
(
'
edui_fixedlayer
'
));
start
();
},
500
);
},
2
0
);
},
2
0
);
},
5
0
);
},
6
0
);
},
6
0
);
},
10
0
);
});
stop
();
});
...
...
@@ -322,7 +275,7 @@ test('delete 事件', function () {
/*trace 3047,3545*/
test
(
'
trace 3047 ,3545 全屏插入表格
'
,
function
()
{
if
(
ua
.
browser
.
gecko
)
return
;
//TODO 1.2.6
//
if (ua.browser.ie && ua.browser.ie < 9)return;//TODO 1.2.6
if
(
ua
.
browser
.
ie
&&
ua
.
browser
.
ie
<
9
)
return
;
//TODO 1.2.6
var
div
=
document
.
body
.
appendChild
(
document
.
createElement
(
'
div
'
));
$
(
div
).
css
(
'
width
'
,
'
500px
'
).
css
(
'
height
'
,
'
500px
'
).
css
(
'
border
'
,
'
1px solid #ccc
'
);
var
editor
=
te
.
obj
[
2
];
...
...
@@ -540,7 +493,7 @@ test('拖拽-最右边的单元格', function () {
ua
.
mouseup
(
tds
[
4
],
{
clientX
:
481
,
clientY
:
21
});
setTimeout
(
function
()
{
var
width2
=
te
.
obj
[
0
].
body
.
getElementsByTagName
(
'
td
'
)[
4
].
width
;
ok
(
width1
-
width2
>
10
,
'
拖拽后单元格宽度改变
'
);
ok
(
width1
!=
width2
,
'
拖拽后单元格宽度改变
'
);
start
();
},
200
);
},
20
);
...
...
_test/tools/br/js/run.js
浏览文件 @
d30e9b88
...
...
@@ -2,7 +2,7 @@ function run( kiss, runnext ) {
window
.
document
.
title
=
kiss
;
var
wb
=
window
.
brtest
=
window
.
brtest
||
{};
wb
.
timeout
=
wb
.
timeout
||
6
0000
;
wb
.
timeout
=
wb
.
timeout
||
10
0000
;
wb
.
breakOnError
=
/breakonerror=true/gi
.
test
(
location
.
search
)
||
$
(
'
input#id_control_breakonerror
'
).
attr
(
'
checked
'
);
wb
.
runnext
=
/batchrun=true/gi
.
test
(
location
.
search
)
||
runnext
...
...
@@ -125,10 +125,14 @@ function run( kiss, runnext ) {
/* 隐藏报告区 */
$
(
'
div#id_reportarea
'
).
empty
().
hide
();
/* 展示执行区 */
if
(
ua
.
browser
.
ie
){
if
(
ua
.
browser
.
ie
){
//释放iframe里面占用的内存
if
(
$
(
'
div#id_runningarea
'
)[
0
].
getElementsByTagName
(
'
iframe
'
).
length
){
var
iframe_old
=
$
(
'
div#id_runningarea
'
)[
0
].
getElementsByTagName
(
'
iframe
'
)[
0
];
iframe_old
.
src
=
''
;
iframe_old
.
src
=
"
javascript:false
"
;
iframe_old
.
contentWindow
.
document
.
write
(
''
);
iframe_old
.
contentWindow
.
close
();
CollectGarbage
();
iframe_old
.
parentNode
.
removeChild
(
iframe_old
);
}
}
...
...
dialogs/background/background.js
浏览文件 @
d30e9b88
...
...
@@ -236,6 +236,7 @@
dialog
.
onok
=
function
()
{
updateBackground
();
editor
.
fireEvent
(
'
saveScene
'
);
};
dialog
.
oncancel
=
function
()
{
editor
.
execCommand
(
'
background
'
,
backupStyle
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录