提交 a4397adb 编写于 作者: C campaign

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

......@@ -90,8 +90,10 @@
///import plugins/music;
///import plugins/video;
///import plugins/autosave;
///import plugins/charts;
///import plugins/autoupload;
///import plugins/section;
///import ui/ui;
///import ui/uiutils;
///import ui/uibase;
......
......@@ -152,7 +152,7 @@ test('trace 2121', function () {
});
test('autofloat:false 禁用IE中的自动加超链接功能', function () {
//在IE中回车/空格自动加连接,这里模拟加连接以后,测试keyup时把添加的链接去掉
if (ua.browser.ie) {
if (ua.browser.ie>8) {//这个用例中,ie8不好模拟startContainer.nodeName = p,用下面的用例测是一样的
var div = document.body.appendChild(document.createElement('div'));
div.id = 'ue';
var editor = UE.getEditor('ue', {autolink: false});
......
......@@ -2,7 +2,7 @@ module( 'plugins.autosave' );
test( '自动保存', function() {
expect(6);
expect(8);
var container = te.obj[0].container,
editor = null,
......@@ -43,9 +43,9 @@ test( '自动保存', function() {
data.content = data.content.toLowerCase();
equal( data.content, "<p>http://www.baidu.com</p>", "成功触发afterautosave事件" );
// equal( editor.execCommand( "getlocaldata" ) !== null, true, "getlocaldata命令正常" );
// editor.execCommand( "clearlocaldata" );
// equal( editor.execCommand( "getlocaldata" ) === null, true, "clearlocaldata命令正常" );
equal( editor.execCommand( "getlocaldata" ) !== null, true, "getlocaldata命令正常" );
editor.execCommand( "clearlocaldata" );
equal( editor.execCommand( "getlocaldata" ) === null, true, "clearlocaldata命令正常" );
} );
......
......@@ -23,23 +23,23 @@ test( '图表命令检测', function() {
stop();
window.setTimeout( function () {
editor.ready( function () {
var firstTd = editor.body.getElementsByTagName("td")[0],
range = editor.selection.getRange();
var firstTd = editor.body.getElementsByTagName("td")[0];
var range = new baidu.editor.dom.Range(editor.document);
range.selectNode( firstTd );
range.collapse();
range.selectNode( firstTd).collapse(true).select();
equal( editor.queryCommandState( 'charts' ), -1, '数据验证失败, 状态为禁用' );
//设置数据格式合法的表格
editor.setContent('<table width="992"><tbody><tr class="firstRow"><th valign="null" width="141"><br></th><th width="141">a</th><th width="141">b</th><th width="142">c</th><th width="142">d</th><th width="142">e</th><th width="142">f</th></tr><tr><th valign="null" width="141">1999</th><td valign="top" width="141">1</td><td valign="top" width="141">2</td><td valign="top" width="142">3</td><td valign="top" width="142">4</td><td valign="top" width="142">5</td><td valign="top" width="142">6</td></tr></tbody></table>');
firstTd = editor.container.getElementsByTagName("td")[0];
firstTd = editor.body.getElementsByTagName("td")[0];
range.selectNode( firstTd );
range.collapse();
range.setStart( firstTd,0).collapse(true).select();
equal( editor.queryCommandState( 'charts' ) != -1, true, '数据合法, 状态可用' );
......@@ -58,8 +58,48 @@ test( '图表命令检测', function() {
equal( tableNode.getAttribute("data-chart") !== null, true, '插入图表命令执行成功' );
start();
setTimeout(function(){
UE.delEditor("container");
document.getElementById("container")&&te.dom.push( document.getElementById("container"));
start();
},300);
} , 500 );
} );
} );
test( '图表命令检测', function() {
// expect(5);
UE.delEditor( te.obj[0] );
var div = document.createElement( "div" );
div.id = "container";
document.body.appendChild( div );
var editor = UE.getEditor( "container", {
initialContent: '<table><tbody><tr><td width="147" valign="top">' +
'<br></td></tr><tr><td width="147" valign="top"><br></td></tr></tbody></table>'
} );
stop();
editor.ready( function () {
var range = editor.selection.getRange();
range.selectNode( editor.body.getElementsByTagName("td")[0]).collapse(true).select();
equal( editor.queryCommandState( 'charts' ), -1, '列数不够, 状态为禁用' );
// <table><tbody><tr class="firstRow"><th></th><th></th></tr><tr><td width="483" valign="top" style="word-break: break-all;">1</td><td width="483" valign="top" style="word-break: break-all;">2</td></tr><tr><td width="483" valign="top" style="word-break: break-all;">2</td><td width="483" valign="top" style="word-break: break-all;">2</td></tr></tbody></table>
editor.setContent('<table><tbody><tr class="firstRow"><th></th><td>e</td></tr><tr><td width="483" valign="top" style="word-break: break-all;">1</td><td width="483" valign="top" style="word-break: break-all;">2</td></tr><tr><td width="483" valign="top" style="word-break: break-all;">2</td><td width="483" valign="top" style="word-break: break-all;">2</td></tr></tbody></table>');
range.selectNode( editor.body.getElementsByTagName("td")[0]).collapse(true).select();
equal( editor.queryCommandState( 'charts' ), -1, '第一行不都是th, 状态为禁用' );
editor.setContent('<table><tbody><tr class="firstRow"><th></th><th>e</th></tr><tr><td width="483" valign="top" style="word-break: break-all;">1</td><td width="483" valign="top" style="word-break: break-all;">2</td></tr><tr><td width="483" valign="top" style="word-break: break-all;">2</td><td width="483" valign="top" style="word-break: break-all;">2</td></tr></tbody></table>');
range.selectNode( editor.body.getElementsByTagName("td")[0]).collapse(true).select();
equal( editor.queryCommandState( 'charts' ), -1, '第一列不是th, 状态为禁用' );
editor.setContent('<table width="992" ><tbody><tr class="firstRow"><th width="364"></th><th width="364"></th><th width="364"></th></tr><tr><th valign="null" width="263">5</th><td valign="top" style="word-break: break-all;" width="364" rowspan="2" colspan="1">5</td><td valign="top" style="word-break: break-all;" width="364">2</td></tr><tr><th valign="null" width="263"></th><td valign="top" style="word-break: break-all;" width="364">2</td></tr> <tr><th></th><td valign="top" colspan="1" rowspan="1">2</td><td valign="top" colspan="1" rowspan="1">4</td></tr></tbody></table>');
range.selectNode( editor.body.getElementsByTagName("td")[0]).collapse(true).select();
equal( editor.queryCommandState( 'charts' ), -1, '每行单元格数不匹配, 状态为禁用' );
editor.setContent('<table width="992"><tbody><tr class="firstRow"><th valign="null" width="263"></th><th width="364"></th><th width="364"></th></tr><tr><th valign="null" width="263"></th><td valign="top" style="word-break: break-all;" width="364" class="selectTdClass">1</td><td valign="top" style="word-break: break-all;" width="364">ee</td></tr><tr><th valign="null" width="263"></th><td valign="top" style="word-break: break-all;" width="364" class="selectTdClass">2</td><td valign="top" style="word-break: break-all;" width="364">2</td></tr></tbody></table>');
range.selectNode( editor.body.getElementsByTagName("td")[0]).collapse(true).select();
equal( editor.queryCommandState( 'charts' ), -1, '内容不是数字, 状态为禁用' );
setTimeout(function(){
UE.delEditor("container");
document.getElementById("container")&&te.dom.push( document.getElementById("container"));
start();
},300);
} );
} );
\ No newline at end of file
......@@ -7,25 +7,29 @@ module( 'plugins.image' );
*/
/*trace1491 修改动图的宽高*/
test( 'trace1491 修改动图的宽高', function () {
setTimeout(function(){
setTimeout(function () {
expect(3);
var editor = te.obj[0];
var range = te.obj[1];
var body = editor.body;
editor.setContent( '<p><br></p>' );
range.setStart( body.firstChild, 0 ).collapse( 1 ).select();
editor.execCommand( 'insertimage', {src:'../data/test.JPG'} );
ua.manualDeleteFillData( editor.body );
range.selectNode( body.firstChild.firstChild ).select();
var img = body.getElementsByTagName( 'img' )[0];
editor.execCommand( 'insertimage', {src:'../data/test.JPG', width:50, height:80} );
img.onload = function () {
equal( $( img ).attr( 'width' ), '50', '比较width' );
equal( $( img ).attr( 'height' ), '80', '比较width' );
start();
};
ok(/data\/test\.JPG/.test( img.getAttribute( 'src' )), '比较src' );
},100);
editor.setContent('<p><br></p>');
setTimeout(function () {
range.setStart(body.firstChild, 0).collapse(1).select();
editor.execCommand('insertimage', {src: '../data/test.JPG'});
setTimeout(function () {
ua.manualDeleteFillData(editor.body);
range.selectNode(body.firstChild.firstChild).select();
var img = body.getElementsByTagName('img')[0];
editor.execCommand('insertimage', {src: '../data/test.JPG', width: 50, height: 80});
setTimeout(function () {
equal($(img).attr('width'), '50', '比较width');
equal($(img).attr('height'), '80', '比较width');
ok(/data\/test\.JPG/.test(img.getAttribute('src')), '比较src');
start();
}, 500);
}, 100);
}, 100);
}, 100);
stop();
} );
test( '插入新图像', function () {
......
......@@ -5,6 +5,54 @@
* 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()
......@@ -12,11 +60,7 @@
test('框选', function () {
var editor = te.obj[0];
var range = te.obj[1];
// var div = document.body.appendChild(document.createElement('div'));
// div.id = 'ue';
// var editor = UE.getEditor('ue');
// editor.ready(function () {
// var range = new baidu.editor.dom.Range(editor.document);
editor.setContent('<p></p>');
setTimeout(function () {
range.setStart(editor.body.firstChild, 0).collapse(true).select();
......@@ -43,16 +87,10 @@ test('框选', function () {
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 () {
// UE.delEditor('ue');
// te.dom.push(document.getElementById('ue'));
// te.dom.push(document.getElementById('edui_fixedlayer'));
start();
// }, 500);
}, 20);
}, 20);
}, 50);
// });
stop();
});
......@@ -365,11 +403,6 @@ test('backspace事件:deletecol', function () {
editor.setContent('<p></p>');
range.setStart(editor.body.firstChild, 0).collapse(true).select();
editor.execCommand('inserttable', {numCols: 3, numRows: 3});
// expect(5);
// editor.addListener('saveScene', function () {
// ok(true);
//
// });
var trs = editor.body.firstChild.getElementsByTagName('tr');
var ut = editor.getUETable(editor.body.firstChild);
var cellsRange = ut.getCellsRange(trs[0].cells[0], trs[2].cells[0]);
......@@ -378,14 +411,12 @@ test('backspace事件:deletecol', function () {
ua.keydown(editor.body, {'keyCode': 8});
stop();
setTimeout(function () {
equal(te.obj[0].body.getElementsByTagName('tr')[0].getElementsByTagName('td').length, 2, '删除整列');
equal(te.obj[0].selection.getRange().collapsed, true, '检查光标');
equal(te.obj[0].selection.getRange().startContainer, te.obj[0].body.getElementsByTagName('td')[0], '检查光标');
equal(editor.body.getElementsByTagName('tr')[0].getElementsByTagName('td').length, 2, '删除整列');
equal(editor.selection.getRange().collapsed, true, '检查光标');
equal(editor.selection.getRange().startContainer, editor.body.getElementsByTagName('td')[0], '检查光标');
start();
}, 20);
}, 100);
});
test('backspace事件:delcells', function () {
//TODO
});
......
......@@ -8,6 +8,7 @@ test( '插入时间和日期', function () {
range.setStart( body.firstChild, 0 ).collapse( 1 ).select();
var date = new Date();
var h = date.getHours();
h = (h < 10) ? ('0' + h) : h;
var min = date.getMinutes();
min = (min < 10) ? ('0' + min) : min;
var sec = date.getSeconds();
......@@ -45,6 +46,7 @@ test( '表格插入时间和日期', function () {
range.setStart( td[0], 0 ).collapse( 1 ).select();
var date = new Date();
var h = date.getHours();
h = (h < 10) ? ('0' + h) : h;
var min = date.getMinutes();
min = (min < 10) ? ('0' + min) : min;
var sec = date.getSeconds();
......
......@@ -119,6 +119,53 @@
</div>
<div id="content" class="content">
<table width="992" data-sort="sortEnabled" class="sortEnabled" interlaced="enabled"><caption><span style="color: rgb(146, 208, 80);">asdf</span><br/></caption><tbody><tr class="ue-table-interlace-color-single firstRow"><th valign="null" width="198"><br/></th><th width="198"><br/></th><th width="198"><br/></th><th width="198"><br/></th><th width="199"><br/></th></tr><tr class="ue-table-interlace-color-double"><th valign="null" width="198"><br/></th><td valign="top" width="198"><br/></td><td valign="top" width="198"><br/></td><td valign="top" width="198"><br/></td><td valign="top" width="199"><br/></td></tr><tr class="ue-table-interlace-color-single"><th valign="null" width="198"><br/></th><td valign="top" width="198"><br/></td><td valign="top" width="198"><br/></td><td valign="top" width="198"><br/></td><td valign="top" width="199"><br/></td></tr><tr class="ue-table-interlace-color-double"><th valign="null" width="198"><br/></th><td valign="top" width="198"><br/></td><td valign="top" width="198"><br/></td><td valign="top" width="198"><br/></td><td valign="top" width="199"><br/></td></tr></tbody></table>
<table width="992" data-chart="title:sdf;subTitle:sdf;xTitle:sdfdgfdfg;yTitle:sdgsdgdfg;suffix:ggg;tip:;dataFormat:1;chartType:1" class="edui-charts-table">
<caption></caption>
<tbody>
<tr class="firstRow">
<th valign="null" width="99"></th>
<th width="99"></th>
<th width="99"></th>
<th width="99"></th>
<th width="99"></th>
<th width="99"></th>
<th width="99"></th>
<th width="99"></th>
<th width="99"></th>
<th width="100"></th>
</tr>
<tr>
<th valign="null" width="99"></th>
<td valign="top" width="99">
1
</td>
<td valign="top" width="99">
6
</td>
<td valign="top" width="99">
o
</td>
<td valign="top" width="99">
6
</td>
<td valign="top" width="99">
6
</td>
<td valign="top" width="99">
6
</td>
<td valign="top" width="99">
6
</td>
<td valign="top" width="99">
6
</td>
<td valign="top" width="100">
6
</td>
</tr>
</tbody>
</table>
</div>
<textarea class="content">asdfasdfasdfasdfasdfadsfa</textarea>
</body>
......
......@@ -2,8 +2,8 @@
class Config
{
public static $BROWSERS = array(
// 'ie8' => array( '10.81.58.64@8500' , "C:\\Program Files\\Internet Explorer\\iexplore.exe" )
// ,
'ie8' => array( '10.81.58.64@8500' , "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")
......
......@@ -125,14 +125,18 @@ function run( kiss, runnext ) {
/* 隐藏报告区 */
$( 'div#id_reportarea' ).empty().hide();
/* 展示执行区 */
// if(ua.browser.ie){
// if(document.frames['running'] ){
// document.frames['running'].location.href = '';
// document.frames['running'].location.reload();
// }
// }
$( 'div#id_runningarea' ).empty().css( 'display', 'block' ).append( '<iframe name = "running" id="' + fid + '" src="' + url + '" class="runningframe"></iframe>' );
if(ua.browser.ie){
if($( 'div#id_runningarea' )[0].getElementsByTagName('iframe').length){
var iframe_old = $( 'div#id_runningarea' )[0].getElementsByTagName('iframe')[0];
iframe_old.src = '';
}
}
var iframe =document.createElement('iframe');
iframe.src= url;
iframe.id= fid;
iframe.className= "runningframe";
$( 'div#id_runningarea' ).empty().css( 'display', 'block' ).append( iframe);
wb.kissstart = new Date().getTime();
};
// 需要根据一次批量执行整合所有文件的覆盖率情况
......
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ page import="java.util.Properties" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.Arrays" %>
<%@ page import="java.io.FileInputStream" %>
<%@ page import="ueditor.Uploader" %>
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ page import="java.util.Properties" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.Arrays" %>
<%@ page import="java.io.FileInputStream" %>
<%@ page import="ueditor.Uploader" %>
<%
<%
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
......@@ -51,9 +51,16 @@ if ( request.getParameter( "fetch" ) != null ) {
}
Uploader up = new Uploader(request);
//获取前端提交的path路径
String dir = request.getParameter( "dir" );
//普通请求中拿不到参数, 则从上传表单中拿
if ( dir == null ) {
dir = up.getParameter("dir");
}
if ( dir == null || "".equals( dir ) ) {
//赋予默认值
......@@ -67,7 +74,6 @@ if ( dir == null || "".equals( dir ) ) {
}
Uploader up = new Uploader(request);
up.setSavePath( dir );
String[] fileType = {".gif" , ".png" , ".jpg" , ".jpeg" , ".bmp"};
up.setAllowFiles(fileType);
......
无法预览此类型文件
......@@ -18,7 +18,7 @@ public class getRemoteImage : IHttpHandler
public void ProcessRequest(HttpContext context)
{
string savePath = context.Server.MapPath("upload/"); //保存文件地址
string savePath = "upload/"; //保存文件地址
string[] filetype = { ".gif", ".png", ".jpg", ".jpeg", ".bmp" }; //文件允许格式
int fileSize = 3000; //文件大小限制,单位kb
......@@ -29,7 +29,7 @@ public class getRemoteImage : IHttpHandler
ArrayList tmpNames = new ArrayList();
WebClient wc = new WebClient();
HttpWebResponse res;
String tmpName = String.Empty;
String filename = String.Empty;
String imgUrl = String.Empty;
String currentType = String.Empty;
......@@ -81,16 +81,18 @@ public class getRemoteImage : IHttpHandler
}
res.Close();
var filepath = savePath + DateTime.Now.ToString("yyyy-MM-dd") + "/";
//创建保存位置
if (!Directory.Exists(savePath))
if (!Directory.Exists(context.Server.MapPath(filepath)))
{
Directory.CreateDirectory(savePath);
Directory.CreateDirectory(context.Server.MapPath(filepath));
}
//写入文件
tmpName = DateTime.Now.ToString("yyyy-MM-dd") + "/" + System.Guid.NewGuid() + currentType;
wc.DownloadFile(imgUrl, savePath + tmpName);
tmpNames.Add("upload/" + tmpName);
filename = filepath + System.Guid.NewGuid() + currentType;
wc.DownloadFile(imgUrl, context.Server.MapPath(filename));
tmpNames.Add(filename);
}
}
catch (Exception)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册