본문 삽입시 이미지 URL을 상대경로로 변경

This commit is contained in:
conory 2016-03-18 20:14:52 +09:00
parent 97a1b578a2
commit 7125cf0e12
7 changed files with 10 additions and 63 deletions

View file

@ -41,9 +41,6 @@ function editorStart_xe(editor_sequence, primary_key, content_key, editor_height
var content = form[content_key].value;
if(xFF && !content) content = '<br />';
// src, href, url의 XE 상대경로를 http로 시작하는 full path로 변경
content = editorReplacePath(content);
form[content_key].value = content;
jQuery("#xpress-editor-"+editor_sequence).val(content);
@ -203,24 +200,10 @@ function editorGetIframe(srl) {
}
function editorReplaceHTML(iframe_obj, content) {
// src, href, url의 XE 상대경로를 http로 시작하는 full path로 변경
content = editorReplacePath(content);
var srl = parseInt(iframe_obj.id.replace(/^.*_/,''),10);
editorRelKeys[srl]["pasteHTML"](content);
}
function editorReplacePath(content) {
// 태그 내 src, href, url의 XE 상대경로를 http로 시작하는 full path로 변경
content = content.replace(/\<([^\>\<]*)(src=|href=|url\()("|\')*([^"\'\)]+)("|\'|\))*(\s|>)*/ig, function(m0,m1,m2,m3,m4,m5,m6) {
if(m2=="url(") { m3=''; m5=')'; } else { if(typeof(m3)=='undefined') m3 = '"'; if(typeof(m5)=='undefined') m5 = '"'; if(typeof(m6)=='undefined') m6 = ''; }
var val = jQuery.trim(m4).replace(/^\.\//,'');
if(/^(http\:|https\:|ftp\:|telnet\:|mms\:|mailto\:|\/|\.\.|\#)/i.test(val)) return m0;
return '<'+m1+m2+m3+request_uri+val+m5+m6;
});
return content;
}
function editorGetAutoSavedDoc(form) {
var param = new Array();
param['mid'] = current_mid;