mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 02:31:40 +09:00
위지윅에디터의 rewrite mod에 따른 첨부이미지/파일등의 경로가 바뀌는 오류를 수정
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6107 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
13ad615f77
commit
5bf4b345a9
6 changed files with 58 additions and 34 deletions
|
|
@ -816,6 +816,8 @@
|
|||
$get_vars[$key] = $val;
|
||||
}
|
||||
unset($get_vars['vid']);
|
||||
unset($get_vars['rnd']);
|
||||
if(isset($get_vars['page'])&&$get_vars['page']<2) unset($get_vars['page']);
|
||||
|
||||
/* member module중의 쪽지함/친구 관리 기능이 communication 모듈로 이전하여 하위 호환성을 위한 act값 변경 */
|
||||
if($get_vars['act'] == 'dispMemberFriend') $get_vars['act'] = 'dispCommunicationFriend';
|
||||
|
|
|
|||
|
|
@ -306,7 +306,6 @@ function procFilter(fo_obj, filter_func) {
|
|||
var editor_sequence = fo_obj.getAttribute('editor_sequence');
|
||||
|
||||
if(typeof(editor_sequence)!='undefined' && editor_sequence && typeof(editorRelKeys)!='undefined') {
|
||||
|
||||
if(jQuery.isFunction(editorRelKeys[editor_sequence]['pasteHTML'])){
|
||||
var content = editorGetContent(editor_sequence);
|
||||
editorRelKeys[editor_sequence]['content'].value = content;
|
||||
|
|
@ -320,25 +319,12 @@ function procFilter(fo_obj, filter_func) {
|
|||
var content = xInnerHtml(dummy.firstChild);
|
||||
xInnerHtml(dummy,content);
|
||||
}
|
||||
|
||||
// img/a 태그의 대상에 대해 경로 재설정 (IE브라우저에서 위지윅 에디터내의 경로를 절대 경로로 바꾸는 버그때문ㅇ)
|
||||
var imgTags = xGetElementsByTagName('IMG', dummy);
|
||||
for(var i=0;i<imgTags.length;i++) {
|
||||
if(imgTags[i].src.indexOf(request_uri)!=-1) {
|
||||
imgTags[i].src = imgTags[i].src.replace(/(.*)files\/(.*)/i,'files/$2');
|
||||
}
|
||||
}
|
||||
var aTags = xGetElementsByTagName('A', dummy);
|
||||
for(var i=0;i<aTags.length;i++) {
|
||||
if(aTags[i].href.indexOf(request_uri)!=-1) {
|
||||
aTags[i].href = aTags[i].href.replace(/(.*)\?module=file&(.*)/i,'./?module=file&$2');
|
||||
}
|
||||
}
|
||||
var content = xInnerHtml(dummy);
|
||||
editorRelKeys[editor_sequence]['content'].value = content;
|
||||
}
|
||||
var regxPath = new RegExp('(src|href)=("|\'){1}'+request_uri.replace(/\//g,'\\/')+'([^"\']+)("|\'){1}','g');
|
||||
content = content.replace(regxPath, '$1="./$3"');
|
||||
editorRelKeys[editor_sequence]['content'].value = content;
|
||||
}
|
||||
|
||||
filter_func(fo_obj);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ function insertEmoticon(obj) {
|
|||
var iframe_obj = opener.editorGetIFrame(opener.editorPrevSrl)
|
||||
|
||||
opener.editorReplaceHTML(iframe_obj, text);
|
||||
opener.editorFocus(opener.editorPrevSrl);
|
||||
self.focus();
|
||||
}
|
||||
|
||||
/* 선택된 이모티콘 목록을 가져옴 */
|
||||
|
|
|
|||
|
|
@ -50,9 +50,16 @@ function editorStart_xe(editor_sequence, primary_key, content_key, editor_height
|
|||
var oHTMLSrcTextarea = htmlsrc.get(0);
|
||||
var elAppContainer = jQuery('.xpress-editor', form).get(0);
|
||||
|
||||
|
||||
oEditor.getFrame = function(){ return oWYSIWYGIFrame;}
|
||||
|
||||
var content = form[content_key].value;
|
||||
var srcPathRegx = /src=("|\'){1}(\.\/)?(files\/attach|files\/cache|files\/faceOff|files\/member_extra_info|modules|common|widgets|widgetstyle|layouts|addons)\/([^"\']+)\.(jpg|jpeg|png|gif)("|\'){1}/g;
|
||||
var hrefPathRegx = /href=("|\'){1}(\.\/)?\?([^"\']+)("|\'){1}/g;
|
||||
content = content.replace(srcPathRegx, 'src="'+request_uri+'$3/$4.$5"');
|
||||
content = content.replace(hrefPathRegx, 'href="'+request_uri+'?$3"');
|
||||
form[content_key].value = content;
|
||||
jQuery("#xpress-editor-"+editor_sequence).val(content);
|
||||
|
||||
// Set standard API
|
||||
editorRelKeys[editor_sequence] = new Array();
|
||||
editorRelKeys[editor_sequence]["primary"] = form[primary_key];
|
||||
|
|
@ -97,6 +104,7 @@ function editorStart_xe(editor_sequence, primary_key, content_key, editor_height
|
|||
oEditor.registerPlugin(new xe.XE_GET_WYSYWYG_MODE(editor_sequence));
|
||||
oEditor.registerPlugin(new xe.XE_Extension(elAppContainer, editor_sequence));
|
||||
oEditor.registerPlugin(new xe.XE_FormatWithSelectUI(elAppContainer));
|
||||
oEditor.registerPlugin(new xe.XE_GET_WYSYWYG_CONTENT());
|
||||
|
||||
if (!jQuery.browser.msie && !jQuery.browser.opera) {
|
||||
oEditor.registerPlugin(new xe.XE_WYSIWYGEnterKey(oWYSIWYGIFrame));
|
||||
|
|
@ -145,6 +153,14 @@ function editorGetIframe(srl) {
|
|||
}
|
||||
|
||||
function editorReplaceHTML(iframe_obj, text) {
|
||||
// 이미지 경로 재지정 (rewrite mod)
|
||||
var srcPathRegx = /src=("|\'){1}(\.\/)?(files\/attach|files\/cache|files\/faceOff|files\/member_extra_info|modules|common|widgets|widgetstyle|layouts|addons)\/([^"\']+)\.(jpg|jpeg|png|gif)("|\'){1}/g;
|
||||
text = text.replace(srcPathRegx, 'src="'+request_uri+'$3/$4.$5"');
|
||||
|
||||
// href 경로 재지정 (rewrite mod)
|
||||
var hrefPathRegx = /href=("|\'){1}(\.\/)?\?([^"\']+)("|\'){1}/g;
|
||||
text = text.replace(hrefPathRegx, 'href="'+request_uri+'?$3"');
|
||||
|
||||
var srl = parseInt(iframe_obj.id.replace(/^.*_/,''),10);
|
||||
editorRelKeys[srl]["pasteHTML"](text);
|
||||
}
|
||||
|
|
@ -162,6 +178,23 @@ xe.XE_GET_WYSYWYG_MODE = jQuery.Class({
|
|||
}
|
||||
});
|
||||
|
||||
// 이미지등의 상대경로를 절대경로로 바꾸는 플러그인
|
||||
xe.XE_GET_WYSYWYG_CONTENT = jQuery.Class({
|
||||
name : "XE_GET_WYSYWYG_CONTENT",
|
||||
|
||||
$ON_MSG_APP_READY : function() {
|
||||
this.oApp.addConverter("IR_TO_WYSIWYG", this.TO_WYSIWYG_SET);
|
||||
},
|
||||
|
||||
TO_WYSIWYG_SET : function(content) {
|
||||
var srcPathRegx = /src=("|\'){1}(\.\/)?(files\/attach|files\/cache|files\/faceOff|files\/member_extra_info|modules|common|widgets|widgetstyle|layouts|addons)\/([^"\']+)\.(jpg|jpeg|png|gif)("|\'){1}/g;
|
||||
var hrefPathRegx = /href=("|\'){1}(\.\/)?\?([^"\']+)("|\'){1}/g;
|
||||
content = content.replace(srcPathRegx, 'src="'+request_uri+'$3/$4.$5"');
|
||||
content = content.replace(hrefPathRegx, 'href="'+request_uri+'?$3"');
|
||||
return content;
|
||||
}
|
||||
});
|
||||
|
||||
// 미리보기 확장기능
|
||||
xe.XE_Preview = jQuery.Class({
|
||||
name : "XE_Preview",
|
||||
|
|
|
|||
|
|
@ -344,6 +344,14 @@ function editorSearchComponent(evt) {
|
|||
|
||||
// 에디터 내의 선택된 부분의 html코드를 변경
|
||||
function editorReplaceHTML(iframe_obj, html) {
|
||||
// 이미지 경로 재지정 (rewrite mod)
|
||||
var srcPathRegx = /src=("|\'){1}(\.\/)?(files\/attach|files\/cache|files\/faceOff|files\/member_extra_info|modules|common|widgets|widgetstyle|layouts|addons)\/([^"\']+)\.(jpg|jpeg|png|gif)("|\'){1}/g;
|
||||
html = html.replace(srcPathRegx, 'src="'+request_uri+'$3/$4.$5"');
|
||||
|
||||
// href 경로 재지정 (rewrite mod)
|
||||
var hrefPathRegx = /href=("|\'){1}(\.\/)?\?([^"\']+)("|\'){1}/g;
|
||||
html = html.replace(hrefPathRegx, 'href="'+request_uri+'?$3"');
|
||||
|
||||
// 에디터가 활성화 되어 있는지 확인 후 비활성화시 활성화
|
||||
var editor_sequence = iframe_obj.contentWindow.document.body.getAttribute("editor_sequence");
|
||||
|
||||
|
|
|
|||
|
|
@ -385,13 +385,13 @@ function insertUploadedFile(editorSequence) {
|
|||
obj.src = file.download_url;
|
||||
}
|
||||
temp_code = '';
|
||||
temp_code += "<img src=\""+request_uri+file.download_url+"\" alt=\""+file.source_filename+"\"";
|
||||
temp_code += "<img src=\""+file.download_url+"\" alt=\""+file.source_filename+"\"";
|
||||
if(obj.complete == true) { temp_code += " width=\""+obj.width+"\" height=\""+obj.height+"\""; }
|
||||
temp_code += " />\r\n";
|
||||
text.push(temp_code);
|
||||
// 이미지외의 경우는 multimedia_link 컴포넌트 연결
|
||||
} else {
|
||||
text.push("<img src=\""+request_uri+"common/tpl/images/blank.gif\" editor_component=\"multimedia_link\" multimedia_src=\""+file.download_url+"\" width=\"400\" height=\"320\" style=\"display:block;width:400px;height:320px;border:2px dotted #4371B9;background:url(./modules/editor/components/multimedia_link/tpl/multimedia_link_component.gif) no-repeat center;\" auto_start=\"false\" alt=\"\" />");
|
||||
text.push("<img src=\"common/tpl/images/blank.gif\" editor_component=\"multimedia_link\" multimedia_src=\""+file.download_url+"\" width=\"400\" height=\"320\" style=\"display:block;width:400px;height:320px;border:2px dotted #4371B9;background:url(./modules/editor/components/multimedia_link/tpl/multimedia_link_component.gif) no-repeat center;\" auto_start=\"false\" alt=\"\" />");
|
||||
}
|
||||
|
||||
// binary파일의 경우 url_link 컴포넌트 연결
|
||||
|
|
@ -400,19 +400,14 @@ function insertUploadedFile(editorSequence) {
|
|||
}
|
||||
}
|
||||
|
||||
// html 모드
|
||||
if(editorMode[editorSequence]=='html'){
|
||||
if(text.length>0) xGetElementById('editor_textarea_'+editorSequence).value += text.join('');
|
||||
|
||||
if(jQuery.isFunction(editorRelKeys[editorSequence]['pasteHTML'])){
|
||||
editorRelKeys[editorSequence]['pasteHTML'](text.join(''));
|
||||
// 위지윅 모드
|
||||
}else{
|
||||
// html 모드
|
||||
if(editorMode[editorSequence]=='html'){
|
||||
if(text.length>0) xGetElementById('editor_textarea_'+editorSequence).value += text.join('');
|
||||
|
||||
// 위지윅 모드
|
||||
}else{
|
||||
var iframe_obj = editorGetIFrame(editorSequence);
|
||||
if(!iframe_obj) return;
|
||||
if(text.length>0) editorReplaceHTML(iframe_obj, text.join(''));
|
||||
}
|
||||
var iframe_obj = editorGetIFrame(editorSequence);
|
||||
if(!iframe_obj) return;
|
||||
if(text.length>0) editorReplaceHTML(iframe_obj, text.join(''));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue