提交 7078dc23 编写于 作者: T taoqili

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

Conflicts:
	_src/plugins/table.js
上级 b9006098
......@@ -173,7 +173,7 @@
* @example
* editor.execCommand("link",{
* href: "http://ueditor.baidu.com", //超链地址,必选
* data_ue_src: "http://ueditor.baidu.com", //UE内部使用参数,与href保持一致即可,可选
* _src: "http://ueditor.baidu.com", //UE内部使用参数,与href保持一致即可,可选
* target: "_self", //目标窗口,可选
* textValue: "UEditor", //链接显示文本,可选
* title: "百度开源富文本编辑器UEditor官网" //标题,可选
......@@ -186,7 +186,7 @@
* @example
* editor.execCommand("insertImage",{
* src: "http://ueditor.baidu.com/logo.jpg", //图片链接地址,必选
* data_ue_src: "http://ueditor.baidu.com/logo.jpg", //UE内部使用参数,与src保持一致即可,可选
* _src: "http://ueditor.baidu.com/logo.jpg", //UE内部使用参数,与src保持一致即可,可选
* width: 300, //图片显示宽度,可选
* height: 400, //图片显示高度,可选
* border: 2, //图片边框,可选
......
......@@ -88,7 +88,7 @@
a.href = a.innerHTML = a.innerHTML.replace(/<[^>]+>/g,'');
href = a.getAttribute("href").replace(new RegExp(domUtils.fillChar,'g'),'');
href = /^(?:https?:\/\/)/ig.test(href) ? href : "http://"+ href;
a.setAttribute('data_ue_src',utils.html(href));
a.setAttribute('_src',utils.html(href));
a.href = utils.html(href);
range.insertNode(a);
......
......@@ -51,7 +51,7 @@ UE.plugins['catchremoteimage'] = function () {
if (ci.getAttribute("word_img")){
continue;
}
var src = ci.getAttribute("data_ue_src") || ci.src || "";
var src = ci.getAttribute("_src") || ci.src || "";
if (/^(https?|ftp):/i.test(src) && !test(src,localDomain)) {
remoteImages.push(src);
}
......@@ -68,7 +68,7 @@ UE.plugins['catchremoteimage'] = function () {
var srcUrls = info.srcUrl.split(separater),
urls = info.url.split(separater);
for (var i = 0, ci; ci = imgs[i++];) {
var src = ci.getAttribute("data_ue_src") || ci.src || "";
var src = ci.getAttribute("_src") || ci.src || "";
for (var j = 0, cj; cj = srcUrls[j++];) {
var url = urls[j - 1];
if (src == cj && url != "error") { //抓取失败时不做替换处理
......@@ -76,7 +76,7 @@ UE.plugins['catchremoteimage'] = function () {
var newSrc = me.options.catcherPath + url;
domUtils.setAttributes(ci, {
"src":newSrc,
"data_ue_src":newSrc
"_src":newSrc
});
break;
}
......
......@@ -458,7 +458,7 @@ UE.plugins['serialize'] = function () {
}
// if(browser.ie && browser.version < 7 )
// node.attributes.orgSrc = node.attributes.src;
// node.attributes.data_ue_src = node.attributes.data_ue_src || node.attributes.src;
// node.attributes._src = node.attributes._src || node.attributes.src;
break;
// case 'li':
// var child = node.children[0];
......@@ -503,7 +503,7 @@ UE.plugins['serialize'] = function () {
//// };
//// node.closed = 1;
//// }
// node.attributes.href && (node.attributes.data_ue_src = node.attributes.href);
// node.attributes.href && (node.attributes._src = node.attributes.href);
// break;
// case 'b':
// node.tag = node.name = 'strong';
......@@ -644,17 +644,17 @@ UE.plugins['serialize'] = function () {
//// };
//// node.closed = null;
// }else{
//// if(node.attributes.data_ue_src){
//// node.attributes.src = node.attributes.data_ue_src;
//// delete node.attributes.data_ue_src;
//// if(node.attributes._src){
//// node.attributes.src = node.attributes._src;
//// delete node.attributes._src;
//// }
// }
// break;
//
// case 'a':
// if(node.attributes.data_ue_src){
// node.attributes.href = node.attributes.data_ue_src;
// delete node.attributes.data_ue_src;
// if(node.attributes._src){
// node.attributes.href = node.attributes._src;
// delete node.attributes._src;
// }
}
......
......@@ -44,7 +44,7 @@ UE.plugins['snapscreen'] = function(){
me.execCommand('insertimage', {
src: editorOptions.snapscreenPath + rs.url,
floatStyle: editorOptions.snapscreenImgAlign,
data_ue_src:editorOptions.snapscreenPath + rs.url
_src:editorOptions.snapscreenPath + rs.url
});
};
var onStartUpload = function(){
......
......@@ -5,29 +5,48 @@
///commandsDialog dialogs\wordimage
UE.plugins["wordimage"] = function(){
UE.plugins["wordimage"] = function () {
var me = this,
images;
me.addInputRule(function (root) {
utils.each(root.getNodesByTagName('img'), function (img) {
var attrs = img.attrs,
flag = parseInt(attrs.width) < 128 || parseInt(attrs.height) < 43,
opt = me.options,
src = opt.UEDITOR_HOME_URL + 'themes/default/images/spacer.gif';
if (attrs['_src']) {
img.setAttr({
width:attrs.width,
height:attrs.height,
alt:attrs.alt,
word_img:attrs._src,
src:src,
'style':'background:url(' + ( flag ? opt.themePath + opt.theme + '/images/word.gif' : opt.langPath + opt.lang + '/images/localimage.png') + ') no-repeat center center;border:1px solid #ddd'
})
}
})
});
me.commands['wordimage'] = {
execCommand : function() {
images = domUtils.getElementsByTagName(me.document.body,"img");
execCommand:function () {
images = domUtils.getElementsByTagName(me.document.body, "img");
var urlList = [];
for(var i=0,ci;ci=images[i++];){
var url=ci.getAttribute("word_img");
for (var i = 0, ci; ci = images[i++];) {
var url = ci.getAttribute("word_img");
url && urlList.push(url);
}
if(images.length){
if (images.length) {
this["word_img"] = urlList;
}
},
queryCommandState: function(){
images = domUtils.getElementsByTagName(me.document.body,"img");
for(var i=0,ci;ci =images[i++];){
if(ci.getAttribute("word_img")){
queryCommandState:function () {
images = domUtils.getElementsByTagName(me.document.body, "img");
for (var i = 0, ci; ci = images[i++];) {
if (ci.getAttribute("word_img")) {
return 1;
}
}
return -1;
}
};
};
\ No newline at end of file
......@@ -277,7 +277,7 @@
if (editor.ui._dialogs.linkDialog) {
var link = editor.queryCommandValue('link');
var url;
if (link && (url = (link.getAttribute('data_ue_src') || link.getAttribute('href', 2)))) {
if (link && (url = (link.getAttribute('_src') || link.getAttribute('href', 2)))) {
var txt = url;
if (url.length > 30) {
txt = url.substring(0, 20) + "...";
......
......@@ -120,7 +120,7 @@ test( '已存在锚点', function() {
range.selectNode(body.firstChild).select();
editor.execCommand( 'anchor', 'hello' );
var name=body.firstChild.firstChild.getAttribute('anchorname');
// equal(ua.getChildHTML(editor.body),'<p><img anchorname=\"hello\" class=\"anchorclass\" data_ue_src=\"undefined\"></p>','更改name');
// equal(ua.getChildHTML(editor.body),'<p><img anchorname=\"hello\" class=\"anchorclass\" _src=\"undefined\"></p>','更改name');
equal(name, 'hello', '更改name');
editor.setContent( '<p><img anchorname="1" class="anchorclass"/></p>' );
range.selectNode(body.firstChild).select();
......
......@@ -15,7 +15,7 @@ test( '输入超链接后回车', function() {
var a = body.firstChild.getElementsByTagName( 'a' )[0];
equal( ua.getChildHTML( a ), 'http://www.baidu.com', '检查a的内容' );
ok( a&&$( a ).attr( 'href' ).indexOf( 'http://www.baidu.com' ) != -1, '检查a的href' );
ok( a&&$( a ).attr( 'data_ue_src' ).indexOf( 'http://www.baidu.com' ) != -1, '检查a的data_ue_src' );
ok( a&&$( a ).attr( '_src' ).indexOf( 'http://www.baidu.com' ) != -1, '检查a的_src' );
start();
}, 20);
} ,20);
......@@ -35,7 +35,7 @@ test( '输入超链接后按空格', function() {
var a = body.firstChild.getElementsByTagName( 'a' )[0];
equal( ua.getChildHTML( a ), 'http://www.baidu.com', '检查a的内容' );
ok( a&&$( a ).attr( 'href' ).indexOf( 'http://www.baidu.com' ) != -1, '检查a的href' );
ok( a&&$( a ).attr( 'data_ue_src' ).indexOf( 'http://www.baidu.com' ) != -1, '检查a的data_ue_src' );
ok( a&&$( a ).attr( '_src' ).indexOf( 'http://www.baidu.com' ) != -1, '检查a的_src' );
start();
}, 20);
},20 );
......@@ -140,7 +140,7 @@ test( 'trace 2121', function() {
var a = body.firstChild.getElementsByTagName( 'a' )[0];
equal( ua.getChildHTML( a ), 'www.baidu.com', '检查a的内容' );
ok( a&&$( a ).attr( 'href' ).indexOf( 'http://www.baidu.com' ) != -1, '检查a的href' );
ok( a&&$( a ).attr( 'data_ue_src' ).indexOf( 'http://www.baidu.com' ) != -1, '检查a的data_ue_src' );
ok( a&&$( a ).attr( '_src' ).indexOf( 'http://www.baidu.com' ) != -1, '检查a的_src' );
start();
}, 20);
} ,20);
......
......@@ -79,12 +79,12 @@ test('首行缩进',function(){
/*trace 2650*/
test( '图像对齐', function () {
var editor = te.obj[0];
editor.setContent( '<p><img src="http://img.baidu.com/hi/jx2/j_0001.gif" width="50" height="51" data_ue_src="http://img.baidu.com/hi/jx2/j_0001.gif"></p>' );
editor.setContent( '<p><img src="http://img.baidu.com/hi/jx2/j_0001.gif" width="50" height="51" _src="http://img.baidu.com/hi/jx2/j_0001.gif"></p>' );
setTimeout(function(){
editor.options.autotypeset.imageBlockLine = 'center';
delete editor.options.autotypeset.textAlign;//imageBlockLine
var html= '<p style="text-align:center"><img src="http://img.baidu.com/hi/jx2/j_0001.gif" width="50" height="51" data_ue_src="http://img.baidu.com/hi/jx2/j_0001.gif"/></p>';
var html1 = '<p style="text-align:center"><img src="http://img.baidu.com/hi/jx2/j_0001.gif" width="50" height="51" data_ue_src="http://img.baidu.com/hi/jx2/j_0001.gif" orgsrc="http://img.baidu.com/hi/jx2/j_0001.gif"/></p>'
var html= '<p style="text-align:center"><img src="http://img.baidu.com/hi/jx2/j_0001.gif" width="50" height="51" _src="http://img.baidu.com/hi/jx2/j_0001.gif"/></p>';
var html1 = '<p style="text-align:center"><img src="http://img.baidu.com/hi/jx2/j_0001.gif" width="50" height="51" _src="http://img.baidu.com/hi/jx2/j_0001.gif" orgsrc="http://img.baidu.com/hi/jx2/j_0001.gif"/></p>'
editor.execCommand('autotypeset');
if(ua.browser.ie==6)
ua.checkHTMLSameStyle(html1 ,editor.document,editor.body,'图像对齐');
......
......@@ -73,7 +73,7 @@ test( '不闭合插入上下标', function () {
range.setStart( body.firstChild.firstChild, 0 ).setEnd( body.firstChild.lastChild, 3 ).select();
editor.execCommand( 'superscript' );
ua.manualDeleteFillData( body );
equal( ua.getChildHTML( body.firstChild ), '<sup><strong>hello1<em>hello2</em></strong></sup><a href="http://www.baid.com/" data_ue_src="http://www.baid.com/"><sup><strong>baidu_link</strong></sup></a><sup>hel</sup>lo3', '普通文本添加上标' );
equal( ua.getChildHTML( body.firstChild ), '<sup><strong>hello1<em>hello2</em></strong></sup><a href="http://www.baid.com/" _src="http://www.baid.com/"><sup><strong>baidu_link</strong></sup></a><sup>hel</sup>lo3', '普通文本添加上标' );
start();
}, 100 )
} );
......
......@@ -24,8 +24,8 @@ test( '成功远程图片抓取', function () {
if ( /upload/.test( src ) ) {
clearInterval( handler );
ok( /upload/.test( imgs[0].getAttribute( 'src' ) ), '图片已经被转存到本地' );
// equal( imgs[0].getAttribute( 'src' ), imgs[0].getAttribute( 'data_ue_src' ), '查看data_ue_src' );
// equal( imgs[1].getAttribute( 'src' ), imgs[1].getAttribute( 'data_ue_src' ), '查看data_ue_src' );
// equal( imgs[0].getAttribute( 'src' ), imgs[0].getAttribute( '_src' ), '查看_src' );
// equal( imgs[1].getAttribute( 'src' ), imgs[1].getAttribute( '_src' ), '查看_src' );
equal( imgs.length, 2, '2个图片' );
start();
} else if ( count > 100 ) {
......
......@@ -33,7 +33,7 @@ test( 'underline and linethrough', function() {
equal( editor.queryCommandValue( 'strikethrough' ), 'underline', 'query command value is not strike' );
ok( editor.queryCommandState( 'underline' ), 'query underline state' );
editor.execCommand( 'strikethrough' );
var html = 'hello<a href="http://www.baidu.com/" data_ue_src = "http://www.baidu.com/" style="text-decoration: line-through">baidu</a>test';
var html = 'hello<a href="http://www.baidu.com/" _src = "http://www.baidu.com/" style="text-decoration: line-through">baidu</a>test';
ua.checkHTMLSameStyle( html, editor.document, body.firstChild, 'check results' );
start();
},50);
......@@ -328,7 +328,7 @@ test( '设置超链接前景色再清除颜色', function() {
editor.execCommand( 'forecolor', 'rgb(255,0,0)' );
editor.execCommand( 'backcolor', 'rgb(0,255,0)' );
editor.execCommand( 'forecolor', 'default' );
var html = '<span style="background-color: rgb(0,255,0)">hello</span><a href="www.baidu.com" data_ue_src = "www.baidu.com" style="text-decoration: underline; "><span style="background-color: rgb(0, 255, 0); ">baidu</span></a>';
var html = '<span style="background-color: rgb(0,255,0)">hello</span><a href="www.baidu.com" _src = "www.baidu.com" style="text-decoration: underline; "><span style="background-color: rgb(0, 255, 0); ">baidu</span></a>';
ua.checkHTMLSameStyle( html, editor.document, editor.body.firstChild, '清除前景色' );
start();
},50);
......
......@@ -63,9 +63,9 @@ test( '修改已有图片的属性', function () {
var body = editor.body;
editor.setContent( '<p><img src="http://img.baidu.com/hi/jx2/j_0004.gif" >hello<img src="http://img.baidu.com/hi/jx2/j_0053.gif" ></p>' );
range.selectNode( body.firstChild.firstChild ).select();
/*加data_ue_src这个参数,否则结果不对,在image.html中也是加了这个参数的*/
editor.execCommand( 'insertimage', {src:'http://img.baidu.com/hi/jx2/j_0018.gif', data_ue_src:"http://img.baidu.com/hi/jx2/j_0018.gif"} );
equal( ua.getChildHTML( body.firstChild ), '<img src="http://img.baidu.com/hi/jx2/j_0018.gif" data_ue_src=\"http://img.baidu.com/hi/jx2/j_0018.gif\">hello<img src="http://img.baidu.com/hi/jx2/j_0053.gif" data_ue_src=\"http://img.baidu.com/hi/jx2/j_0053.gif\">', '检查插入的图像地址' );
/*加_src这个参数,否则结果不对,在image.html中也是加了这个参数的*/
editor.execCommand( 'insertimage', {src:'http://img.baidu.com/hi/jx2/j_0018.gif', _src:"http://img.baidu.com/hi/jx2/j_0018.gif"} );
equal( ua.getChildHTML( body.firstChild ), '<img src="http://img.baidu.com/hi/jx2/j_0018.gif" _src=\"http://img.baidu.com/hi/jx2/j_0018.gif\">hello<img src="http://img.baidu.com/hi/jx2/j_0053.gif" _src=\"http://img.baidu.com/hi/jx2/j_0053.gif\">', '检查插入的图像地址' );
equal( body.firstChild.childNodes.length, 3, '2个img孩子' );
} );
/*trace1491 修改动图的宽高*/
......
......@@ -39,7 +39,7 @@ test( '给图片添加超链接', function () {
editor.setContent( '<p><img style="width: 200px;height: 200px" src="http://ueditor.baidu.com/img/logo.png">hello</p>' );
range.selectNode( editor.body.firstChild.firstChild ).select();
editor.execCommand( 'link', {href:'http://www.baidu.com/'} );
var html = '<a href="http://www.baidu.com/" ><img src="http://ueditor.baidu.com/img/logo.png" style="width: 200px;height: 200px" data_ue_src="http://ueditor.baidu.com/img/logo.png"></a>hello';
var html = '<a href="http://www.baidu.com/" ><img src="http://ueditor.baidu.com/img/logo.png" style="width: 200px;height: 200px" _src="http://ueditor.baidu.com/img/logo.png"></a>hello';
ua.checkHTMLSameStyle( html, editor.document, editor.body.firstChild, '给图片添加超链接' );
} );
......
......@@ -18,12 +18,12 @@ test( 'trace 800:清除 超链接的颜色', function () {
editor.setContent( '<a href="http://www.baidu.com/">baidu</a>' );
range.selectNode( editor.body.firstChild ).select();
editor.execCommand( 'forecolor', 'rgb(255,0,0)' );
var html = '<a href="http://www.baidu.com/" data_ue_src = "http://www.baidu.com/" style="color: rgb(255, 0, 0); text-decoration: underline; "><span style="color: rgb(255, 0, 0); ">baidu</span></a>';
var html = '<a href="http://www.baidu.com/" _src = "http://www.baidu.com/" style="color: rgb(255, 0, 0); text-decoration: underline; "><span style="color: rgb(255, 0, 0); ">baidu</span></a>';
ua.checkHTMLSameStyle( html, editor.document, editor.body.firstChild, '查看加了颜色后超链接的样式' )
// ok( ua.haveSameAllChildAttribs( editor.body.firstChild, p1 ), '查看加了颜色后超链接的样式' );
editor.execCommand( 'removeformat' );
var cl = ua.browser.ie && ua.browser.ie == 8 ? 'class=\"\"' : "";
html = '<a href="http://www.baidu.com/" ' + cl + ' data_ue_src = "http://www.baidu.com/">baidu</a>';
html = '<a href="http://www.baidu.com/" ' + cl + ' _src = "http://www.baidu.com/">baidu</a>';
ua.checkHTMLSameStyle( html, editor.document, editor.body.firstChild, '查看清除样式后超链接的样式' );
} );
......
......@@ -16,7 +16,7 @@ test( '转换img标签', function () {
var node = serialize.parseHTML( html );
node = serialize.transformInput( node );
var spa=ua.browser.ie==6?' orgSrc="'+editor.options.UEDITOR_HOME_URL+'themes/default/images/spacer.gif"':'';
equal( serialize.toHTML( node ).replace( new RegExp( '[\r' + domUtils.fillChar + ']*', 'g' ), '' ), '<img src="'+editor.options.UEDITOR_HOME_URL+'themes/default/images/spacer.gif" width="553" height="275" word_img="file:///C:/DOCUME~1/DONGYA~1/LOCALS~1/Temp/msohtmlclip1/01/clip_image002.jpg" style="background:url('+editor.options.UEDITOR_HOME_URL+'lang/'+editor.options.lang+'/images/localimage.png) no-repeat center center;border:1px solid #ddd"'+spa+' data_ue_src="'+editor.options.UEDITOR_HOME_URL+'themes/default/images/spacer.gif" />' , '转换img标签');
equal( serialize.toHTML( node ).replace( new RegExp( '[\r' + domUtils.fillChar + ']*', 'g' ), '' ), '<img src="'+editor.options.UEDITOR_HOME_URL+'themes/default/images/spacer.gif" width="553" height="275" word_img="file:///C:/DOCUME~1/DONGYA~1/LOCALS~1/Temp/msohtmlclip1/01/clip_image002.jpg" style="background:url('+editor.options.UEDITOR_HOME_URL+'lang/'+editor.options.lang+'/images/localimage.png) no-repeat center center;border:1px solid #ddd"'+spa+' _src="'+editor.options.UEDITOR_HOME_URL+'themes/default/images/spacer.gif" />' , '转换img标签');
} );
test( '转换script标签', function () {
var serialize = te.obj[0].serialize;
......
......@@ -234,7 +234,7 @@ test( 'trace 1727:插入超链接后再插入空格,空格不能被删除', fu
editor.execCommand( 'source' );
setTimeout( function () {
editor.execCommand( 'source' );
equal( editor.body.innerHTML.toLowerCase(), '<p>&nbsp;<a href="http://www.baidu.com/" data_ue_src=\"http://www.baidu.com/\">绝对路径网址</a>&nbsp;&nbsp;ddd</p>', '查看空格是否被删除' );
equal( editor.body.innerHTML.toLowerCase(), '<p>&nbsp;<a href="http://www.baidu.com/" _src=\"http://www.baidu.com/\">绝对路径网址</a>&nbsp;&nbsp;ddd</p>', '查看空格是否被删除' );
start();
}, 100 );
}, 100 );
......@@ -251,7 +251,7 @@ test( '关于空格的问题', function () {
editor.execCommand( 'source' );
setTimeout( function () {
ua.manualDeleteFillData( editor.body );
equal( editor.body.innerHTML.toLowerCase().replace(/[\r\n\t]/g,''), '<ol><li><p>&nbsp;dd&nbsp;jj&nbsp;</p></li><li><p>&nbsp;ll&nbsp;kdkd&nbsp;<a href="http://www.baidu.com/" data_ue_src="http://www.baidu.com/">&nbsp;baidu&nbsp;</a>&nbsp;</p></li></ol>' );
equal( editor.body.innerHTML.toLowerCase().replace(/[\r\n\t]/g,''), '<ol><li><p>&nbsp;dd&nbsp;jj&nbsp;</p></li><li><p>&nbsp;ll&nbsp;kdkd&nbsp;<a href="http://www.baidu.com/" _src="http://www.baidu.com/">&nbsp;baidu&nbsp;</a>&nbsp;</p></li></ol>' );
start();
}, 150 );
}, 100 );
......
此差异已折叠。
......@@ -112,7 +112,7 @@
str="";
for(var i=0,ci;ci=filesList[i++];){
var src = editor.options.UEDITOR_HOME_URL + "dialogs/attachment/fileTypeImages/"+(map[ci.type]||"icon_default.png");
str += "<p style='line-height: 16px;'><img src='"+ src + "' data_ue_src='"+src+"' />" +
str += "<p style='line-height: 16px;'><img src='"+ src + "' _src='"+src+"' />" +
"<a href='"+editor.options.filePath + ci.url+"'>" + ci.original + "</a></p>";
}
editor.execCommand("insertHTML",str);
......
......@@ -77,7 +77,7 @@ var bindClick = function () {
this.title = lang.toggleSelect + w + "X" + h;
};
img.setAttribute(k < 35 ? "src" : "lazy_src", editor.options.imageManagerPath + ci.replace(/\s+|\s+/ig, ""));
img.setAttribute("data_ue_src", editor.options.imageManagerPath + ci.replace(/\s+|\s+/ig, ""));
img.setAttribute("_src", editor.options.imageManagerPath + ci.replace(/\s+|\s+/ig, ""));
}
},
......
......@@ -48,7 +48,7 @@ function InsertSmiley( url, evt ) {
var obj = {
src:editor.options.emotionLocalization ? editor.options.UEDITOR_HOME_URL + "dialogs/emotion/" + url : url
};
obj.data_ue_src = obj.src;
obj._src = obj.src;
editor.execCommand( 'insertimage', obj );
if ( !evt.ctrlKey ) {
dialog.popup.hide();
......
......@@ -204,7 +204,7 @@ var imageUploader = {},
if (ci.getAttribute("selected")) {
var url = ci.getAttribute("src", 2).replace(/(\s*$)/g, ""), img = {};
img.src = url;
img.data_ue_src = url;
img._src = url;
imgObjs.push(img);
}
}
......@@ -229,7 +229,7 @@ var imageUploader = {},
if (!flagImg) return; //粘贴地址后如果没有生成对应的预览图,可以认为本次粘贴地址失败
if (!checkNum([width, height, border, vhSpace])) return false;
imgObj.src = url.value;
imgObj.data_ue_src = url.value;
imgObj._src = url.value;
imgObj.width = width.value;
imgObj.height = height.value;
imgObj.border = border.value;
......@@ -279,7 +279,7 @@ var imageUploader = {},
tmpObj.title = ci.title;
tmpObj.floatStyle = align;
//修正显示时候的地址数据,如果后台返回的是图片的绝对地址,那么此处无需修正
tmpObj.data_ue_src = tmpObj.src = editor.options.imagePath + ci.url;
tmpObj._src = tmpObj.src = editor.options.imagePath + ci.url;
imgObjs.push(tmpObj);
}
insertImage(imgObjs);
......@@ -394,7 +394,7 @@ var imageUploader = {},
function showImageInfo(img) {
if (!img.getAttribute("src") || !img.src) return;
var wordImgFlag = img.getAttribute("word_img");
g("url").value = wordImgFlag ? wordImgFlag.replace("&amp;", "&") : (img.getAttribute('data_ue_src') || img.getAttribute("src", 2).replace("&amp;", "&"));
g("url").value = wordImgFlag ? wordImgFlag.replace("&amp;", "&") : (img.getAttribute('_src') || img.getAttribute("src", 2).replace("&amp;", "&"));
g("width").value = img.width || 0;
g("height").value = img.height || 0;
g("border").value = img.getAttribute("border") || 0;
......@@ -617,7 +617,7 @@ var imageUploader = {},
this.onload = null;
};
img.setAttribute(k < 35 ? "src" : "lazy_src", editor.options.imageManagerPath + ci.replace(/\s+|\s+/ig, ""));
img.setAttribute("data_ue_src", editor.options.imageManagerPath + ci.replace(/\s+|\s+/ig, ""));
img.setAttribute("_src", editor.options.imageManagerPath + ci.replace(/\s+|\s+/ig, ""));
}
},
......
......@@ -44,7 +44,7 @@
orgText;
link = domUtils.findParentByTagName( link, "a", true );
if(link){
url = utils.html(link.getAttribute( 'data_ue_src' ) || link.getAttribute( 'href', 2 ));
url = utils.html(link.getAttribute( '_src' ) || link.getAttribute( 'href', 2 ));
if(rangeLink === link && !link.getElementsByTagName('img').length){
text.removeAttribute('disabled');
......@@ -79,7 +79,7 @@
'href' : href,
'target' : $G("target").checked ? "_blank" : '_self',
'title' : $G("title").value.replace(/^\s+|\s+$/g, ''),
'data_ue_src':href
'_src':href
};
//修改链接内容的情况太特殊了,所以先做到这里了
//todo:情况多的时候,做到command里
......
......@@ -633,7 +633,7 @@ function exec(scrawlObj) {
var imgObj = {},
url = editor.options.scrawlPath + responseObj.url;
imgObj.src = url;
imgObj.data_ue_src = url;
imgObj._src = url;
editor.execCommand("insertImage", imgObj);
dialog.close();
} else {
......
......@@ -35,7 +35,7 @@ function addOkListener() {
for (var j = 0,url; url = imageUrls[j++];) {
if (src.indexOf(url.original.replace(" ","")) != -1) {
img.src = editor.options.wordImagePath + url.url;
img.setAttribute("data_ue_src", editor.options.wordImagePath + url.url); //同时修改"data_ue_src"属性
img.setAttribute("_src", editor.options.wordImagePath + url.url); //同时修改"_src"属性
img.setAttribute("title",url.title);
parent.baidu.editor.dom.domUtils.removeAttributes(img, ["word_img","style","width","height"]);
editor.fireEvent("selectionchange");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册