本已经找到了代码 :
insertimage : function(url, title, width, height, border, align) {
title = _undef(title, '');
border = _undef(border, 0);
var html = '<img src="' + _escape(url) + '" data-ke-src="' + _escape(url) + '" ';
if (width) {
html += 'width="' + _escape(width) + '" ';
}
if (height) {
html += 'height="' + _escape(height) + '" ';
}
if (title) {
html += 'title="' + _escape(title) + '" ';
}
if (align) {
html += 'align="' + _escape(align) + '" ';
}
html += 'alt="' + _escape(title) + '" ';
html += '/>';
return this.inserthtml(html);
},
这个官方的代码,在编辑时,插入的图片其代码为:
<img alt="" src="/uploadfile/image/20130326/2013032609270174174.jpg" />
可是,于我想这张图能加放A标签的时,想达到的效果为:
<a href="/uploadfile/image/20130326/2013032609270174174.jpg" rel="lightbox[roadtrip]"> <img alt="" src="/uploadfile/image/20130326/2013032609270174174.jpg" />
于是我将kindeditor.js中的以上代码进行修改,修改结果如下:
insertimage : function(url, title, width, height, border, align) {
title = _undef(title, '');
border = _undef(border, 0);
var html = '<a href="' + _escape(url) + '" rel="lightbox[roadtrip]"><img src="' + _escape(url) + '" data-ke-src="' + _escape(url) + '" ';
if (width) {
html += 'width="' + _escape(width) + '" ';
}
if (height) {
html += 'height="' + _escape(height) + '" ';
}
if (title) {
html += 'title="' + _escape(title) + '" ';
}
if (align) {
html += 'align="' + _escape(align) + '" ';
}
html += 'alt="' + _escape(title) + '" ';
html += '/></a>';
return this.inserthtml(html);
},
这时,在编辑器里插入图片,一看代码能达的效果却少了一个属性,代码为:
<a href="/uploadfile/image/20130326/2013032609270174174.jpg"> <img alt="" src="/uploadfile/image/20130326/2013032609270174174.jpg" />
不知道是什么情况:rel="lightbox[roadtrip]" 这段就不见了,
于我我换了一属性方式改为:class="A" 时, 却还是有的!就是不知道,为什么加入rel="lightbox[roadtrip]" 这个属性时为什么,就不行!
求解决!!小弟先谢过了!