提交 be65ed29 编写于 作者: C campaign

Merge remote-tracking branch 'origin/dev-1.3.0' into dev-1.3.0

......@@ -46,9 +46,13 @@ UEditor是由百度web前端研发部开发所见即所得富文本web编辑器
1. [部署编辑器](_doc/部署编辑器.md "部署编辑器")
2. [拖拽插入和粘贴图片](_doc/拖拽插入和粘贴图片.md "拖拽插入和粘贴图片")
2. [提交表单并展示内容](_doc/提交表单并展示内容.md "提交表单并展示内容")
3. [ASP支持说明](_doc/ASP支持说明.md "ASP支持说明")
3. [部署编辑器](_doc/路径配置.md "路径配置")
4. [拖拽插入和粘贴图片](_doc/拖拽插入和粘贴图片.md "拖拽插入和粘贴图片")
5. [ASP支持说明](_doc/ASP支持说明.md "ASP支持说明")
## 二次开发文档 ##
......
......@@ -15,21 +15,23 @@ labelMap:{
}
```
### 第二步:修改_src/ui/editorui.js文件
在_src/ui/editorui.js文件中,找到的btnCmds数组变量,在其中同样增加一个“showmsg”字符串。
在_src/ui/editorui.js文件中,找到的btnCmds数组变量,在其中同样增加一个"showmsg"字符串。
```javascript
var btnCmds = [..., 'mergecells', 'deletetable', 'showmsg'];
```
这时候,清空缓存刷新下页面!工具栏的对应位置是否出现了一个自己定义的按钮呢?如下图所示:
![新增按钮](http://www.ueditorbbs.com/data/attachment/forum/201304/24/110436m5k2bkayokzp7goy.png)
![新增按钮](images/newbtn.png)
### 第三步:修改themes/default/ueditor.css文件
由于此时未设置对应按钮的图片样式,所以会显示默认的“B”字符。要想让其显示成自己需要的图标样式,接着按照下面的步骤动手吧。
找到themes/default/ueditor.css文件,增加一条样式定义:
找到themes/default/ueditor.css文件,增加一条样式定义。此处的样式定义了showmsg图标在UEditor默认的精灵Icon图片(themes/default/images/icons.png)中的位置偏移。如需更改成另外图标,只需添加图标到该图片文件中,然后设置偏移值即可。
```css
.edui-for-showmsg .edui-icon {
......@@ -37,11 +39,10 @@ var btnCmds = [..., 'mergecells', 'deletetable', 'showmsg'];
}
```
此处的样式定义了showmsg图标在UEditor默认的精灵Icon图片(themes/default/images/icons.png)中的位置偏移。如需更改成另外图标,只需添加图标到该图片文件中,然后设置偏移值即可。
![新增按钮并设置背景](images/newbtn-setstyle.png)
![](http://www.ueditorbbs.com/data/attachment/forum/201304/24/110501r0rv0sc1l1qsvxh5.png)
### 第四步:添加_src/plugins/showmsg.js文件
### 第四步:添加_src/plugins/showmsg.js插件文件
到此为止,在UI层面已经完成了一个工具栏图标的显示和各种状态变化的逻辑,但是我们发现点击按钮之后毫无反应。那是必然的,我们还必须为该按钮绑定属于它自己的事件处理方法。
......@@ -58,7 +59,7 @@ UE.commands['showmsg'] = {
};
```
然后将该文件引入ueditor:打开_examples/editor_api.js文件,在paths数组中的适当位置(一般是指默认提供的插件部分地址的最后)增加一条记录
然后将该文件引入ueditor:打开_examples/editor_api.js文件,在paths数组中的适当位置(一般是指默认提供的插件部分地址的最后)增加一行plugins/showmsg.js的引用
```javascript
'plugins/webapp.js',
......@@ -68,11 +69,11 @@ UE.commands['showmsg'] = {
再次刷新页面点击一下按钮吧!
![新增一个按钮](http://www.ueditorbbs.com/data/attachment/forum/201304/24/110503by10zh7cqqzt3qgy.png)
![新增按钮并设置动作](images/newbtn-setaction.png)
## 打包文件
注意:正式使用ueditor时,需要把编辑器源码打包成ueditor.all.js文件,具体打包方法请看打包教程:
[拖拽插入和粘贴图片](_doc/拖拽插入和粘贴图片.md "拖拽插入和粘贴图片")
[使用grunt打包源代码](使用grunt打包源代码.md "拖拽插入和粘贴图片")
# 拖拽插入和粘贴图片
## 支持版本 ##
支持 UEditor 1.3.0+ 的版本
## 支持功能 ##
1. 拖放图片上传并插入到编辑器
2. 使用QQ,百度HI等工具截屏,粘贴到编辑器
3. 复制网页上的图片,粘贴到编辑器
\ No newline at end of file
# 提交表单并展示内容
## 提交表单设置
1. 按照[部署编辑器](部署编辑器.md "部署编辑器")的教程,完成编辑器加载
2. 把容器放到form表单里面,设置好要提交的路径,如下面代码中的<form>标签
```html
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>ueditor demo</title>
</head>
<body>
<!-- 加载编辑器的容器 -->
<script id="container" name="content" type="text/plain">这里写你的初始化内容</script>
<!-- 配置文件 -->
<script type="text/javascript" src="ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
var editor = UE.getEditor('container');
</script>
</body>
</html>
```
\ No newline at end of file
......@@ -6,7 +6,7 @@
2. 解压后的文件目录结构如下所示
![ueditor解压后的目录列表](http://www.ueditorbbs.com/data/attachment/forum/201311/01/173606n69mm6rku9ld05m2.png)
![ueditor解压后的目录列表](images/sourcedir.png)
3. 目录和文件说明:
......@@ -23,22 +23,24 @@
4. 在你页面head内,引用ueditor文件、配置文件和语言包文件。插入下面的代码,修改引用路文件的路径。
```html
<!-- 配置文件 -->
<script type="text/javascript" src="./ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="./ueditor/ueditor.all.js"></script>
<!-- 语言包文件 -->
<script type="text/javascript" src="./ueditor/lang/zh-cn/zh-cn.js"></script>
```
5. 在你页面head内,引用ueditor文件、配置文件和语言包文件。插入下面的代码,修改引用路文件的路径。
```html
<!-- 配置文件 -->
<script type="text/javascript" src="./ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="./ueditor/ueditor.all.js"></script>
<!-- 语言包文件 -->
<script type="text/javascript" src="./ueditor/lang/zh-cn/zh-cn.js"></script>
```
\ No newline at end of file
```html
<!-- 配置文件 -->
<script type="text/javascript" src="./ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="./ueditor/ueditor.all.js"></script>
<!-- 语言包文件 -->
<script type="text/javascript" src="./ueditor/lang/zh-cn/zh-cn.js"></script>
```
5. 然后在代码文件中设置编辑器容器,并添加编辑器的实例化代码。具体代码示例如下。
```html
<script id="container" name="content" type="text/plain">这里写你的初始化内容</script>
<script type="text/javascript">
var editor = UE.getEditor('container')
</script>
```
6. 如果看到了下面这样的编辑器,说明已经部署成功!
![demo.png](images/demo.png)
\ No newline at end of file
......@@ -76,6 +76,7 @@ UE.plugins['autoheight'] = function () {
domUtils.on(browser.ie ? me.body : me.document, browser.webkit ? 'dragover' : 'drop', function () {
clearTimeout(timer);
timer = setTimeout(function () {
//trace:3681
adjustHeight.call(me);
}, 100);
......
......@@ -61,7 +61,7 @@
<!--</target>-->
<target name="executeplugin" depends="init,coverage">
<get src="http://${serverip}/${git.project}/_test/tools/br/runall.php?ci=true&amp;cov=true&amp;filter=plugins&amp;ie8main=plugins,!plugins/t,!plugins/w,!plugins/s;plugins/source&amp;ie8supp=plugins/t;plugins/w;plugins/s"
<get src="http://${serverip}/${git.project}/_test/tools/br/runall.php?ci=true&amp;cov=true&amp;filter=plugins&amp;ie8main=plugins,!plugins/t,!plugins/w,!plugins/s;plugins/source&amp;ie8supp=plugins/t;plugins/w;plugins/s&amp;ie9main=plugins,!plugins/t,!plugins/w,!plugins/s;plugins/source&amp;ie9supp=plugins/t;plugins/w;plugins/s"
dest="/tmp/${git.user}_${git.project}plugin.php"/>
</target>
<target name="getreportplugin" depends="init,coverage,executeplugin">
......
......@@ -28,7 +28,7 @@ test( '插入锚点后切换源码', function() {
setTimeout( function() {
start();
}, 50 );
}, 100);
}, 200);
}, 20 );
} );
......
......@@ -24,7 +24,7 @@ test( 'getAllHtml能取到背景', function() {
});
stop();
} );
test( 'active trace 3744 setContent 背景色', function() {
test( ' trace 3744 setContent 背景色', function() {
var editor = te.obj[0];
editor.setContent('<p> <br/></p><p style="display:none;" data-background="background-repeat:no-repeat; background-position:center center; background-color:#8064A2; "> <br/></p>');
stop();
......@@ -33,7 +33,7 @@ test( 'active trace 3744 setContent 背景色', function() {
start();
},50);
});
test( 'ie active trace 3751 3748 设置 背景色', function() {
test( ' trace 3751 3748 设置 背景色', function() {
var editor = te.obj[0];
var backgroundStyle = {'background-repeat': "no-repeat", 'background-position': "center center", 'background-color': "#4F81BD"};
editor.setContent('<p><br/></p>');
......@@ -41,8 +41,8 @@ test( 'ie active trace 3751 3748 设置 背景色', function() {
stop();
setTimeout(function(){
equal(editor.queryCommandValue('background')['background-repeat'],'no-repeat');
equal(editor.queryCommandValue('background')['background-color'].toLowerCase(),'#4f81bd');
same(editor.queryCommandValue('background')['background-position'],"center center");
equal(ua.formatColor(editor.queryCommandValue('background')['background-color'].toLowerCase()),'#4f81bd');
ok(/center/.test(editor.queryCommandValue('background')['background-position']));
editor.execCommand('source');
setTimeout(function(){
ua.checkSameHtml(editor.body.lastChild.outerHTML,'<p style="display:none;" data-background="background-repeat:no-repeat; background-position:center center; background-color:#4F81BD; "><br/></p>','source查看 背景色');
......
......@@ -192,7 +192,7 @@ test( 'trace 3698 1.3.0 版本修复: script(style)标签里面的内容不转
equal(editor.document.getElementById('myEditor').innerHTML,'var ue=UE.getEditor("editor");','内容不转码')
// todo 1.3.0 trace 3698
editor.setContent('<style type="text/css" id="myEditor"> .clear { clear: both; } </style>');
equal(editor.document.getElementById('myEditor').innerHTML,' .clear { clear: both; } ','内容不转码');
equal(editor.getContent(),'<p><br/></p><style type="text/css" id="myEditor">.clear { clear: both; }</style>','内容不转码');
} );
test( '转换style标签:style data不为空', function () {
var editor = te.obj[0];
......
......@@ -76,10 +76,10 @@ test('通过选区路径取range', function () {
editor.execCommand('elementpath', '3');
setTimeout(function () {
range = editor.selection.getRange();
if (ua.browser.gecko||ua.browser.ie>8) {
if (ua.browser.gecko||ua.browser.ie>9) {
ua.checkResult(range, tbodys[0], tbodys[0], 1, 2, false, '取range--tr');
} else {
if (ua.browser.ie&&ua.browser.ie<9)
if (ua.browser.ie&&ua.browser.ie<10)
ua.checkResult(range, tds[2].firstChild, tds[3].lastChild, 0, 2, false, '取range--tr');
else
ua.checkResult(range, tds[2].firstChild, editor.body, 0, 1, false, '取range--tr');
......@@ -111,7 +111,7 @@ test('通过选区路径取range', function () {
start();
}, 20);
}, 20);
}, 20);
}, 100);
}, 20);
}, 50);
});
......
......@@ -106,8 +106,8 @@ test('underline and linethrough', function () {
var body = editor.body;
ua.manualDeleteFillData(editor.body);
range.selectNode(body.firstChild.firstChild.nextSibling).select();
equal(editor.queryCommandValue('underline'), 'underline', 'query command value is underline');
equal(editor.queryCommandValue('strikethrough'), 'underline', 'query command value is not strike');
ok(/underline/.test(editor.queryCommandValue('underline')), 'query command value is underline');
ok(/underline/.test(editor.queryCommandValue('strikethrough')), 'query command value is underline');
ok(editor.queryCommandState('underline'), 'query underline state');
editor.execCommand('strikethrough');
var html = 'hello<a href="http://www.baidu.com/" _href=\"http://www.baidu.com/\" style="text-decoration: line-through" >baidu</a>test';
......
......@@ -7,7 +7,7 @@
*/
module( "plugins.keystrokes" );
test('active trace 3714跨节点输入tab键',function(){
test('trace 3714跨节点输入tab键',function(){
var editor = te.obj[0];
editor.setContent( '<h1>hello<br></h1><p>he<img src="http://img.baidu.com/hi/jx2/j_0015.gif" />oll</p>' );
var range = te.obj[1];
......@@ -16,8 +16,8 @@ test('active trace 3714跨节点输入tab键',function(){
ua.keydown(editor.body,{'keyCode':9});
ua.keyup(editor.body,{'keyCode':9});
setTimeout(function(){
equal(te.obj[0].undoManger.list.length,2,'');
var html = '<h1>hello<br></h1><p>&nbsp;&nbsp;&nbsp;&nbsp;he<img src=\"http://img.baidu.com/hi/jx2/j_0015.gif\" _src=\"http://img.baidu.com/hi/jx2/j_0015.gif\">oll</p>';
equal(te.obj[0].undoManger.list.length,1,'');
var html = '<h1>hello<br></h1><p>&nbsp;&nbsp;&nbsp;&nbsp;oll</p>';
equal(ua.getChildHTML(te.obj[0].body),html,'跨节点输入tab键');
start();
},20);
......
......@@ -21,7 +21,7 @@ test('trace 3381:查找',function(){
//
///*trace 974,先替换再撤销再全部替换,则不会替换
//* ie下会出现的bug*/
test('active trace 3697全部替换',function(){
test(' trace 3697全部替换',function(){
//todo trace 3697
if(ua.browser.opera)
return;
......@@ -52,7 +52,7 @@ test('active trace 3697全部替换',function(){
//});
/*trace 973*/
test('active trace 3697替换内容包含查找内容',function(){
test(' trace 3697替换内容包含查找内容',function(){
if(ua.browser.opera)
return;
var editor = te.obj[0];
......
......@@ -145,7 +145,7 @@ test('b,i标签,切换源码后自动转换成strong和em', function () {
equal(editor.getContent(), '<p><strong>加粗的内容</strong><em>斜体的内容<strong>加粗且斜体</strong></em></p>');
});
test('activ trace 3739 trace 1734 range的更新/特殊符号的转换', function () {
test(' trace 3739 trace 1734 range的更新/特殊符号的转换', function () {
var editor = te.obj[0];
editor.setContent('<p>"<></p>');
setTimeout(function () {
......@@ -164,7 +164,7 @@ test('activ trace 3739 trace 1734 range的更新/特殊符号的转换', functio
editor.execCommand('source');
setTimeout(function () {
editor.execCommand('source');
equal(editor.getContent(), "<p>&#39;<img src=\"http://nsclick.baidu.com/u.gif?&amp;asdf=&quot;sdf&amp;asdfasdfs;asdf\"/></p>");
equal(editor.getContent(), "<p>&#39;<img src=\"http://nsclick.baidu.com/u.gif?&amp;asdf=%22sdf&amp;asdfasdfs;asdf\"/></p>");
start();
}, 100);
}, 100);
......
......@@ -182,7 +182,7 @@ test('从外面粘贴表格到表格-表格中不能粘完整的表格', functio
start();
}, 50);
});
test('active ie9 trace 3729 从外面粘贴表格到表格-在caption中粘贴,只粘贴文本内容', function () {
test(' trace 3729 从外面粘贴表格到表格-在caption中粘贴,只粘贴文本内容', function () {
var editor = te.obj[0];
var range = te.obj[1];
editor.setContent('');
......
......@@ -985,7 +985,7 @@ test('trace 3195:合并单元格后删除列再撤销', function () {
});
/*trace 3231*/
test('active trace 3779 trace 3231:向右合并--拆分成列', function () {
test(' trace 3779 trace 3231:向右合并--拆分成列', function () {
if(ua.browser.ie&& ua.browser.ie>8)return;//todo
var editor = te.obj[0];
var range = te.obj[1];
......
......@@ -50,6 +50,7 @@ test("getMaxCols", function () {
});
test("ie9 active trace 3728 getSameEndPosCells", function () {
if(ua.browser.ie==9)return;
var table = getTable("<tr><td rowspan='2'>1</td><td>2</td><td>3</td></tr><tr><td>2</td><td>3</td></tr>"),
ut = new UT(table);
var cell = table.rows[0].cells[0],
......
......@@ -11,7 +11,7 @@ function getTable(str) {
return div.firstChild;
}
UT = UE.UETable;
test("active trace 3715 sortTable", function () {
test(" trace 3715 sortTable", function () {
var table = getTable("<tr><td>01</td><td>2</td><td>3</td><td>4</td><td>6</td><td>7</td></tr>" +
"<tr><td>11</td><td>2</td><td>3</td><td>4</td><td>6</td><td>7</td></tr>" +
"<tr><td>21</td><td>2</td><td>3</td><td>4</td><td>6</td><td>7</td></tr>"),
......
......@@ -25,7 +25,7 @@ test('空格', function () {
equal(editor.getContentLength(true), 22, '清空后编辑器中22个空格');
});
test('active trace 3744 超出最大', function () {
test(' trace 3744 超出最大', function () {
var div = document.body.appendChild(document.createElement('div'));
div.id = 'ue';
......
......@@ -3,18 +3,21 @@
{
public static $BROWSERS = array(
'ie8supp' => array( '10.81.58.64@8500' , "C:\\Program Files\\Internet Explorer\\iexplore.exe" )
, 'ie9main' => array( '10.81.96.46' , "C:\\Program Files\\Internet Explorer\\iexplore.exe" )
,
'firefox' => array( '10.81.58.86@8500' , "C:\\Program Files\\mozilla firefox\\firefox.exe" )
// 'firefox' => array( '10.81.96.46@8500' , "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe" )
// , '360ie8' => array('10.81.58.64@8500',"C:\\Program Files\\360\\360se\\360SE.exe")
// , '360ie7' => array( '10.81.58.87@8500' , "C:\\Program Files\\360\\360se\\360SE.exe" )
, 'ie9' => array( '10.81.96.46' , "C:\\Program Files\\Internet Explorer\\iexplore.exe" )
// , 'ie6' => array( '10.81.58.86@8500' , "C:\\Program Files\\Internet Explorer\\iexplore.exe" )
, 'chrome' => array( '10.81.58.63@8500' , "C:\\Documents and Settings\\geqa1\\Local Settings\\Application Data\\Google\\Chrome\\Application\\chrome.exe" )
,
'ie8main' => array( '10.81.58.64@8500' , "C:\\Program Files\\Internet Explorer\\iexplore.exe" )
, 'ie9supp' => array( '10.81.96.46' , "C:\\Program Files\\Internet Explorer\\iexplore.exe" )
// , 'ie7' => array( '10.81.58.87@8500' , "C:\\Program Files\\Internet Explorer\\iexplore.exe" )
// , 'opera' => array( '10.81.58.64@8500' , "C:\\Program Files\\Opera\\opera.exe" )
// , 'safari' => array( '10.81.58.63@8500' , "C:\\Program Files\\Safari\\Safari.exe" )
......
body{
overflow: hidden;
width: 540px;
}
.wrapper {
margin: 10px auto 0;
font-size: 12px;
overflow: hidden;
width: 520px;
height: 275px;
}
.clear {
......@@ -15,13 +21,13 @@
.wrapper .right {
float: right;
margin-right: 10px;
border-left: 2px dotted #EDEDED;
padding-left: 15px;
}
.section {
margin-bottom: 20px;
margin-bottom: 15px;
width: 240px;
overflow: hidden;
}
......@@ -36,10 +42,13 @@
.section ul {
list-style: none;
overflow: hidden;
clear: both;
}
.section li {
float: left;
width: 120px;;
}
.section .tone {
......
......@@ -11,22 +11,20 @@
<div class="section">
<h3><var id="lang_tableStyle"></var></h3>
<ul>
<ul>
<li>
<label><input type="checkbox" id="J_title" name="style"/><var id="lang_insertTitle"></var></label>
</li>
<li>
<label><input type="checkbox" id="J_titleCol" name="style"/><var id="lang_insertTitleCol"></var></label>
</li>
</ul>
<ul>
<li>
<label><input type="checkbox" id="J_caption" name="style"/><var id="lang_insertCaption"></var></label>
</li>
<li>
<label><input type="checkbox" id="J_sorttable" name="style"/><var id="lang_orderbycontent"></var></label>
</li>
</ul>
<li>
<label onselectstart="return false"><input type="checkbox" id="J_title" name="style"/><var id="lang_insertTitle"></var></label>
</li>
<li>
<label onselectstart="return false"><input type="checkbox" id="J_titleCol" name="style"/><var id="lang_insertTitleCol"></var></label>
</li>
</ul>
<ul>
<li>
<label onselectstart="return false"><input type="checkbox" id="J_caption" name="style"/><var id="lang_insertCaption"></var></label>
</li>
<li>
<label onselectstart="return false"><input type="checkbox" id="J_sorttable" name="style"/><var id="lang_orderbycontent"></var></label>
</li>
</ul>
<div class="clear"></div>
</div>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册