relative image url/fix conflict when upload attachment again
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -110,13 +110,8 @@ tinymce.PluginManager.add('leaui_image', function(editor, url) {
|
||||
var data = datas[i];
|
||||
var src = data.src;
|
||||
// the network image
|
||||
var trueSrc;
|
||||
if(src.indexOf("http://") != -1 || src.indexOf("https://") != -1) {
|
||||
trueSrc = src;
|
||||
} else {
|
||||
trueSrc = url + "/" + src;
|
||||
}
|
||||
data.src = trueSrc;
|
||||
var trueSrc = src;
|
||||
data.src = src;
|
||||
|
||||
var renderImage = function(data) {
|
||||
// 这里, 如果图片宽度过大, 这里设置成500px
|
||||
@ -125,7 +120,7 @@ tinymce.PluginManager.add('leaui_image', function(editor, url) {
|
||||
var imgElm;
|
||||
// 先显示loading...
|
||||
d.id = '__mcenew' + i;
|
||||
d.src = "http://leanote.com/images/loading-24.gif";
|
||||
d.src = "/images/loading-24.gif";
|
||||
imgElm = dom.createHTML('img', d);
|
||||
editor.insertContent(imgElm);
|
||||
imgElm = dom.get(d.id);
|
||||
@ -164,8 +159,7 @@ tinymce.PluginManager.add('leaui_image', function(editor, url) {
|
||||
(function(data) {
|
||||
ajaxPost("/file/copyImage", {userId: UserInfo.UserId, fileId: fileId, toUserId: curNote.UserId}, function(re) {
|
||||
if(reIsOk(re) && re.Id) {
|
||||
var urlPrefix = UrlPrefix; // window.location.protocol + "//" + window.location.host;
|
||||
data.src = urlPrefix + "/api/file/getImage?fileId=" + re.Id;
|
||||
data.src = "/api/file/getImage?fileId=" + re.Id;
|
||||
}
|
||||
renderImage(data);
|
||||
});
|
||||
|
@ -1 +1 @@
|
||||
var LEAUI_DATAS=[];tinymce.PluginManager.add("leaui_image",function(a,b){function c(a,b){function c(a,c){d.parentNode.removeChild(d),b({width:a,height:c})}var d=document.createElement("img");d.onload=function(){c(d.clientWidth,d.clientHeight)},d.onerror=function(){c()},d.src=a;var e=d.style;e.visibility="hidden",e.position="fixed",e.bottom=e.left=0,e.width=e.height="auto",document.body.appendChild(d)}function d(){function d(){var a='<iframe id="leauiIfr" src="/album/index?'+(new Date).getTime()+'" frameborder="0"></iframe>';return a}var e=a.dom,f=a.selection.getContent(),g=/<img.*?\/>/g,h=f.match(g),i=document.createElement("p"),j=[];for(var k in h){i.innerHTML=h[k];var l=i.firstChild;if(l&&"IMG"==l.nodeName){var m={};m.src=e.getAttrib(l,"data-src")||e.getAttrib(l,"src"),m.width=e.getAttrib(l,"width"),m.height=e.getAttrib(l,"height"),m.title=e.getAttrib(l,"title"),j.push(m)}}LEAUI_DATAS=j;var n=$(document).width()-10;n>805&&(n=805);var o=$(document).height()-100;o>365&&(o=365),win=a.windowManager.open({title:"Image",width:n,height:o,html:d(),buttons:[{text:"Cancel",onclick:function(){this.parent().parent().close()}},{text:"Insert Image",subtype:"primary",onclick:function(d){for(var f=document.getElementById("leauiIfr").contentWindow,g=f.document.getElementById("preview"),h=g.childNodes,i=[],j=0;j<h.length;++j){var d=h[j];if(d.firstChild&&"IMG"==d.firstChild.nodeName){var k=d.firstChild,l={};l.src=k.getAttribute("src"),l.width=k.getAttribute("data-width"),l.height=k.getAttribute("data-height"),l.title=k.getAttribute("data-title"),i.push(l)}}for(var j in i){var m,n=i[j],o=n.src;m=-1!=o.indexOf("http://")||-1!=o.indexOf("https://")?o:b+"/"+o,n.src=m;var p=function(b){var d=function(b,c){var d,f={};return f.id="__mcenew"+c,f.src="http://leanote.com/images/loading-24.gif",d=e.createHTML("img",f),a.insertContent(d),d=e.get(f.id),function(a){a&&a.width&&(a.width>600&&(a.width=600),b.width=a.width),e.setAttrib(d,"src",b.src),e.setAttrib(d,"title",b.title),e.setAttrib(d,"id",null)}}(b,j);c(b.src,d)},q="";if(fileIds=m.split("fileId="),2==fileIds.length&&fileIds[1].length=="53aecf8a8a039a43c8036282".length&&(q=fileIds[1]),q){var r;Note&&Note.getCurNote&&(r=Note.getCurNote()),r&&r.UserId!=UserInfo.UserId?!function(a){ajaxPost("/file/copyImage",{userId:UserInfo.UserId,fileId:q,toUserId:r.UserId},function(b){if(reIsOk(b)&&b.Id){var c=UrlPrefix;a.src=c+"/api/file/getImage?fileId="+b.Id}p(a)})}(n):p(n)}else p(n)}this.parent().parent().close()}}]})}a.addButton("leaui_image",{icon:"image",tooltip:"Insert/edit image",onclick:d,stateSelector:"img:not([data-mind-json])"}),a.addMenuItem("leaui_image",{icon:"image",text:"Insert image",onclick:d,context:"insert",prependToContext:!0});var e=!1;a.on("dragstart",function(a){LEA.readOnly&&(a.preventDefault(),a.stopPropagation()),e=!0}),a.on("dragend",function(a){e=!1}),a.on("dragover",function(a){e&&(a.preventDefault(),a.stopPropagation())})});
|
||||
var LEAUI_DATAS=[];tinymce.PluginManager.add("leaui_image",function(a,b){function c(a,b){function c(a,c){d.parentNode.removeChild(d),b({width:a,height:c})}var d=document.createElement("img");d.onload=function(){c(d.clientWidth,d.clientHeight)},d.onerror=function(){c()},d.src=a;var e=d.style;e.visibility="hidden",e.position="fixed",e.bottom=e.left=0,e.width=e.height="auto",document.body.appendChild(d)}function d(){function b(){var a='<iframe id="leauiIfr" src="/album/index?'+(new Date).getTime()+'" frameborder="0"></iframe>';return a}var d=a.dom,e=a.selection.getContent(),f=/<img.*?\/>/g,g=e.match(f),h=document.createElement("p"),i=[];for(var j in g){h.innerHTML=g[j];var k=h.firstChild;if(k&&"IMG"==k.nodeName){var l={};l.src=d.getAttrib(k,"data-src")||d.getAttrib(k,"src"),l.width=d.getAttrib(k,"width"),l.height=d.getAttrib(k,"height"),l.title=d.getAttrib(k,"title"),i.push(l)}}LEAUI_DATAS=i;var m=$(document).width()-10;m>805&&(m=805);var n=$(document).height()-100;n>365&&(n=365),win=a.windowManager.open({title:"Image",width:m,height:n,html:b(),buttons:[{text:"Cancel",onclick:function(){this.parent().parent().close()}},{text:"Insert Image",subtype:"primary",onclick:function(b){for(var e=document.getElementById("leauiIfr").contentWindow,f=e.document.getElementById("preview"),g=f.childNodes,h=[],i=0;i<g.length;++i){var b=g[i];if(b.firstChild&&"IMG"==b.firstChild.nodeName){var j=b.firstChild,k={};k.src=j.getAttribute("src"),k.width=j.getAttribute("data-width"),k.height=j.getAttribute("data-height"),k.title=j.getAttribute("data-title"),h.push(k)}}for(var i in h){var l=h[i],m=l.src,n=m;l.src=m;var o=function(b){var e=function(b,c){var e,f={};return f.id="__mcenew"+c,f.src="/images/loading-24.gif",e=d.createHTML("img",f),a.insertContent(e),e=d.get(f.id),function(a){a&&a.width&&(a.width>600&&(a.width=600),b.width=a.width),d.setAttrib(e,"src",b.src),d.setAttrib(e,"title",b.title),d.setAttrib(e,"id",null)}}(b,i);c(b.src,e)},p="";if(fileIds=n.split("fileId="),2==fileIds.length&&fileIds[1].length=="53aecf8a8a039a43c8036282".length&&(p=fileIds[1]),p){var q;Note&&Note.getCurNote&&(q=Note.getCurNote()),q&&q.UserId!=UserInfo.UserId?!function(a){ajaxPost("/file/copyImage",{userId:UserInfo.UserId,fileId:p,toUserId:q.UserId},function(b){reIsOk(b)&&b.Id&&(a.src="/api/file/getImage?fileId="+b.Id),o(a)})}(l):o(l)}else o(l)}this.parent().parent().close()}}]})}a.addButton("leaui_image",{icon:"image",tooltip:"Insert/edit image",onclick:d,stateSelector:"img:not([data-mind-json])"}),a.addMenuItem("leaui_image",{icon:"image",text:"Insert image",onclick:d,context:"insert",prependToContext:!0});var e=!1;a.on("dragstart",function(a){LEA.readOnly&&(a.preventDefault(),a.stopPropagation()),e=!0}),a.on("dragend",function(a){e=!1}),a.on("dragover",function(a){e&&(a.preventDefault(),a.stopPropagation())})});
|
@ -117,4 +117,4 @@
|
||||
writeScripts();
|
||||
})(this);
|
||||
|
||||
// $hash: fb4edcbc9aa7f82a3fc6e0a6a3486fec
|
||||
// $hash: f4f33bf34dc8356762ead5554b3b4576
|
@ -39899,13 +39899,8 @@ tinymce.PluginManager.add('leaui_image', function(editor, url) {
|
||||
var data = datas[i];
|
||||
var src = data.src;
|
||||
// the network image
|
||||
var trueSrc;
|
||||
if(src.indexOf("http://") != -1 || src.indexOf("https://") != -1) {
|
||||
trueSrc = src;
|
||||
} else {
|
||||
trueSrc = url + "/" + src;
|
||||
}
|
||||
data.src = trueSrc;
|
||||
var trueSrc = src;
|
||||
data.src = src;
|
||||
|
||||
var renderImage = function(data) {
|
||||
// 这里, 如果图片宽度过大, 这里设置成500px
|
||||
@ -39914,7 +39909,7 @@ tinymce.PluginManager.add('leaui_image', function(editor, url) {
|
||||
var imgElm;
|
||||
// 先显示loading...
|
||||
d.id = '__mcenew' + i;
|
||||
d.src = "http://leanote.com/images/loading-24.gif";
|
||||
d.src = "/images/loading-24.gif";
|
||||
imgElm = dom.createHTML('img', d);
|
||||
editor.insertContent(imgElm);
|
||||
imgElm = dom.get(d.id);
|
||||
@ -39953,8 +39948,7 @@ tinymce.PluginManager.add('leaui_image', function(editor, url) {
|
||||
(function(data) {
|
||||
ajaxPost("/file/copyImage", {userId: UserInfo.UserId, fileId: fileId, toUserId: curNote.UserId}, function(re) {
|
||||
if(reIsOk(re) && re.Id) {
|
||||
var urlPrefix = UrlPrefix; // window.location.protocol + "//" + window.location.host;
|
||||
data.src = urlPrefix + "/api/file/getImage?fileId=" + re.Id;
|
||||
data.src = "/api/file/getImage?fileId=" + re.Id;
|
||||
}
|
||||
renderImage(data);
|
||||
});
|
||||
|
2
public/tinymce/tinymce.full.min.js
vendored
2
public/tinymce/tinymce.full.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user