mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-09 03:52:15 +09:00
본문 삽입시 이미지 URL을 상대경로로 변경
This commit is contained in:
parent
97a1b578a2
commit
7125cf0e12
7 changed files with 10 additions and 63 deletions
|
|
@ -103,7 +103,7 @@
|
||||||
|
|
||||||
if(result.error == 0) {
|
if(result.error == 0) {
|
||||||
if(/\.(jpe?g|png|gif)$/i.test(result.source_filename)) {
|
if(/\.(jpe?g|png|gif)$/i.test(result.source_filename)) {
|
||||||
temp_code += '<img src="' + window.request_uri + result.download_url + '" alt="' + result.source_filename + '" editor_component="image_link" data-file-srl="' + result.file_srl + '" />';
|
temp_code += '<img src="' + result.download_url + '" alt="' + result.source_filename + '" editor_component="image_link" data-file-srl="' + result.file_srl + '" />';
|
||||||
temp_code += "\r\n<p><br></p>\r\n";
|
temp_code += "\r\n<p><br></p>\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -244,10 +244,10 @@
|
||||||
if(!fileinfo) return;
|
if(!fileinfo) return;
|
||||||
|
|
||||||
if(/\.(jpe?g|png|gif)$/i.test(fileinfo.source_filename)) {
|
if(/\.(jpe?g|png|gif)$/i.test(fileinfo.source_filename)) {
|
||||||
temp_code += '<img src="' + window.request_uri + fileinfo.download_url + '" alt="' + fileinfo.source_filename + '" editor_component="image_link" data-file-srl="' + fileinfo.file_srl + '" />';
|
temp_code += '<img src="' + fileinfo.download_url + '" alt="' + fileinfo.source_filename + '" editor_component="image_link" data-file-srl="' + fileinfo.file_srl + '" />';
|
||||||
temp_code += "\r\n<p><br></p>\r\n";
|
temp_code += "\r\n<p><br></p>\r\n";
|
||||||
} else {
|
} else {
|
||||||
temp_code += '<a href="' + window.request_uri + fileinfo.download_url + '" data-file-srl="' + fileinfo.file_srl + '">' + fileinfo.source_filename + "</a>\n";
|
temp_code += '<a href="' + fileinfo.download_url + '" data-file-srl="' + fileinfo.file_srl + '">' + fileinfo.source_filename + "</a>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -379,6 +379,3 @@
|
||||||
return u;
|
return u;
|
||||||
};
|
};
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,6 @@ function editorGetContent(editor_sequence) {
|
||||||
|
|
||||||
//Replace html content to editor
|
//Replace html content to editor
|
||||||
function editorReplaceHTML(iframe_obj, content) {
|
function editorReplaceHTML(iframe_obj, content) {
|
||||||
content = editorReplacePath(content);
|
|
||||||
|
|
||||||
var editor_sequence = parseInt(iframe_obj.id.replace(/^.*_/, ''), 10);
|
var editor_sequence = parseInt(iframe_obj.id.replace(/^.*_/, ''), 10);
|
||||||
|
|
||||||
_getCkeInstance(editor_sequence).insertHtml(content, "unfiltered_html");
|
_getCkeInstance(editor_sequence).insertHtml(content, "unfiltered_html");
|
||||||
|
|
@ -29,16 +27,3 @@ function editorReplaceHTML(iframe_obj, content) {
|
||||||
function editorGetIFrame(editor_sequence) {
|
function editorGetIFrame(editor_sequence) {
|
||||||
return jQuery('#ckeditor_instance_' + editor_sequence).get(0);
|
return jQuery('#ckeditor_instance_' + editor_sequence).get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -41,9 +41,6 @@ function editorStart_xe(editor_sequence, primary_key, content_key, editor_height
|
||||||
var content = form[content_key].value;
|
var content = form[content_key].value;
|
||||||
if(xFF && !content) content = '<br />';
|
if(xFF && !content) content = '<br />';
|
||||||
|
|
||||||
// src, href, url의 XE 상대경로를 http로 시작하는 full path로 변경
|
|
||||||
content = editorReplacePath(content);
|
|
||||||
|
|
||||||
form[content_key].value = content;
|
form[content_key].value = content;
|
||||||
jQuery("#xpress-editor-"+editor_sequence).val(content);
|
jQuery("#xpress-editor-"+editor_sequence).val(content);
|
||||||
|
|
||||||
|
|
@ -203,24 +200,10 @@ function editorGetIframe(srl) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function editorReplaceHTML(iframe_obj, content) {
|
function editorReplaceHTML(iframe_obj, content) {
|
||||||
// src, href, url의 XE 상대경로를 http로 시작하는 full path로 변경
|
|
||||||
content = editorReplacePath(content);
|
|
||||||
|
|
||||||
var srl = parseInt(iframe_obj.id.replace(/^.*_/,''),10);
|
var srl = parseInt(iframe_obj.id.replace(/^.*_/,''),10);
|
||||||
editorRelKeys[srl]["pasteHTML"](content);
|
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) {
|
function editorGetAutoSavedDoc(form) {
|
||||||
var param = new Array();
|
var param = new Array();
|
||||||
param['mid'] = current_mid;
|
param['mid'] = current_mid;
|
||||||
|
|
|
||||||
|
|
@ -5868,9 +5868,6 @@ function editorStart_xe(editor_sequence, primary_key, content_key, editor_height
|
||||||
var content = form[content_key].value;
|
var content = form[content_key].value;
|
||||||
if(xFF && !content) content = '<br />';
|
if(xFF && !content) content = '<br />';
|
||||||
|
|
||||||
// src, href, url의 XE 상대경로를 http로 시작하는 full path로 변경
|
|
||||||
content = editorReplacePath(content);
|
|
||||||
|
|
||||||
form[content_key].value = content;
|
form[content_key].value = content;
|
||||||
jQuery("#xpress-editor-"+editor_sequence).val(content);
|
jQuery("#xpress-editor-"+editor_sequence).val(content);
|
||||||
|
|
||||||
|
|
@ -6030,24 +6027,10 @@ function editorGetIframe(srl) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function editorReplaceHTML(iframe_obj, content) {
|
function editorReplaceHTML(iframe_obj, content) {
|
||||||
// src, href, url의 XE 상대경로를 http로 시작하는 full path로 변경
|
|
||||||
content = editorReplacePath(content);
|
|
||||||
|
|
||||||
var srl = parseInt(iframe_obj.id.replace(/^.*_/,''),10);
|
var srl = parseInt(iframe_obj.id.replace(/^.*_/,''),10);
|
||||||
editorRelKeys[srl]["pasteHTML"](content);
|
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) {
|
function editorGetAutoSavedDoc(form) {
|
||||||
var param = new Array();
|
var param = new Array();
|
||||||
param['mid'] = current_mid;
|
param['mid'] = current_mid;
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ class fileModel extends file
|
||||||
$obj->file_size = $file_info->file_size;
|
$obj->file_size = $file_info->file_size;
|
||||||
$obj->disp_file_size = FileHandler::filesize($file_info->file_size);
|
$obj->disp_file_size = FileHandler::filesize($file_info->file_size);
|
||||||
if($file_info->direct_download=='N') $obj->download_url = $this->getDownloadUrl($file_info->file_srl, $file_info->sid, $file_info->module_srl);
|
if($file_info->direct_download=='N') $obj->download_url = $this->getDownloadUrl($file_info->file_srl, $file_info->sid, $file_info->module_srl);
|
||||||
else $obj->download_url = str_replace('./', '', $file_info->uploaded_filename);
|
else $obj->download_url = $file_info->uploaded_filename;
|
||||||
$obj->direct_download = $file_info->direct_download;
|
$obj->direct_download = $file_info->direct_download;
|
||||||
$obj->cover_image = ($file_info->cover_image === 'Y') ? true : false;
|
$obj->cover_image = ($file_info->cover_image === 'Y') ? true : false;
|
||||||
$files[] = $obj;
|
$files[] = $obj;
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,6 @@ function doSyncPageContent() {
|
||||||
if(!fo_obj.document_srl || fo_obj.document_srl.value == '0') {
|
if(!fo_obj.document_srl || fo_obj.document_srl.value == '0') {
|
||||||
try {
|
try {
|
||||||
var content = Base64.decode(xInnerHtml(obj));
|
var content = Base64.decode(xInnerHtml(obj));
|
||||||
content = editorReplacePath(content);
|
|
||||||
get_by_id("content_fo").content.value = content;
|
get_by_id("content_fo").content.value = content;
|
||||||
xe.Editors["1"].exec("SET_IR", [content]);
|
xe.Editors["1"].exec("SET_IR", [content]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue