1.dialogs\image\image.js
23行:getAllPic()
getAllPic: function (sel, $w, editor) {
var me = this,
arr = [],
$imgs = $(sel, $w);
$.each($imgs, function (index, node) {
$(node).removeAttr("width").removeAttr("height");
// if (node.width > editor.options.initialFrameWidth) {
// me.scale(node, editor.options.initialFrameWidth -
// parseInt($(editor.body).css("padding-left")) -
// parseInt($(editor.body).css("padding-right")));
// }
//修改版:設置爲相對路徑
var srcFixed = node.src;
if(srcFixed.indexOf(projectName) > -1){
srcFixed = srcFixed.substring(srcFixed.indexOf(projectName),srcFixed.length);
}
console.log(srcFixed);
/* return arr.push({
_src: node.src,
src: node.src
});*/
return arr.push({
//_src: srcFixed,
src: srcFixed
});
});
return arr;
},
2.\_src\plugins\paste.js
140行
// 圖片的話如果是本地圖片去除前域名,保留相對路徑
$.each(root.getNodesByTagName('img'), function (i, node) {
var srcFixed = node.attrs['src'];
if(srcFixed.indexOf(projectName) > -1){
srcFixed = srcFixed.substring(srcFixed.indexOf(projectName),srcFixed.length);
node.attrs['src'] = srcFixed;
}
});
html = {'html': root.toHtml()};