diff --git a/modules/editor/components/url_link/urllink.class.php b/modules/editor/components/url_link/url_link.class.php similarity index 90% rename from modules/editor/components/url_link/urllink.class.php rename to modules/editor/components/url_link/url_link.class.php index 06c8f7cb6..a33fd924b 100644 --- a/modules/editor/components/url_link/urllink.class.php +++ b/modules/editor/components/url_link/url_link.class.php @@ -1,11 +1,11 @@ upload_target_srl = $upload_target_srl; $this->component_path = $component_path; } @@ -27,7 +27,7 @@ **/ function execute() { - $url = sprintf('./?module=editor&act=dispPopup&target_srl=%s&component=urllink', $this->upload_target_srl); + $url = sprintf('./?module=editor&act=dispPopup&target_srl=%s&component=url_link', $this->upload_target_srl); $this->add('tpl', ''); $this->add('open_window', 'Y'); diff --git a/modules/editor/tpl/js/editor.js b/modules/editor/tpl/js/editor.js index f4e135d5f..465cafa69 100755 --- a/modules/editor/tpl/js/editor.js +++ b/modules/editor/tpl/js/editor.js @@ -52,7 +52,7 @@ function editorStart(upload_target_srl) { ''+ ''+ ''+ - ''+ + ''+ content+ ''+ ''; @@ -67,6 +67,10 @@ function editorStart(upload_target_srl) { else xAddEventListener(contentDocument, 'keypress',editorKeyPress); xAddEventListener(contentDocument,'mousedown',editorHideObject); + // 플러그인 감시를 위한 더블클릭 이벤트 걸기 + xAddEventListener(contentDocument,'dblclick',editorSearchComponent); + xAddEventListener(document,'dblclick',editorSearchComponent); + //xAddEventListener(document,'keypress',editorKeyPress); xAddEventListener(document,'mouseup',editorEventCheck); xAddEventListener(document,'mousedown',editorHideObject); @@ -264,6 +268,51 @@ function editorProcComponent(ret_obj, response_tags) { } } +// 본문내에 포함된 컴포넌트를 찾는 함수 (더블클릭시) +function editorSearchComponent(evt) { + var e = new xEvent(evt); + + // 선택되어진 object부터 상단으로 이동하면서 editor_component attribute가 있는지 검사 + var obj = e.target; + while(obj && !obj.getAttribute("editor_component")) { + obj = xParent(obj); + } + + if(!obj) obj = e.target; + + var editor_component = obj.getAttribute("editor_component"); + + // editor_component를 찾지 못했을 경우에 이미지/텍스트/링크의 경우 기본 컴포넌트와 연결 + if(!editor_component) { + // 이미지일 경우 + if(obj.nodeName == "IMG") editor_component = "image_link"; + + // 링크거나 텍스트인 경우 + else if(obj.nodeName == "A" || obj.nodeName == "BODY") editor_component = "url_link"; + } + + // 아무런 editor_component가 없다면 return + if(!editor_component) return; + + // upload_target_srl을 찾음 + var tobj = obj; + while(tobj && tobj.nodeName != "BODY") { + tobj = xParent(tobj); + } + if(!tobj || tobj.nodeName != "BODY" || !tobj.getAttribute("upload_target_srl")) return; + var upload_target_srl = tobj.getAttribute("upload_target_srl"); + + // 해당 컴포넌트를 찾아서 실행 + editorPrevSrl = upload_target_srl; + + var params = new Array(); + params['component'] = editor_component; + params['upload_target_srl'] = upload_target_srl; + + var response_tags = new Array('error', 'message', 'component', 'upload_target_srl', 'tpl', 'open_window', 'popup_url'); + exec_xml('editor', 'dispComponent', params, editorProcComponent, response_tags, editor_form_list[upload_target_srl]); +} + // focus function editorFocus(upload_target_srl) { var iframe_obj = editorGetIFrame(upload_target_srl); @@ -327,48 +376,6 @@ function editorDoInsertUrl(link, upload_target_srl) { editorReplaceHTML(iframe_obj, link); } -function editorInsertImage(url, src_align) { - if(!url) return; - //if(!/^(http|ftp)/i.test(url)) url = 'http://'+url; - - editorFocus(editorPrevSrl); - - var html = "\"i\"
"; - return html; -} - -function editorInsertMultimedia(url, width, height) { - if(url) { - var html = editorGetMultimediaHtml(url, width, height); - editorFocus(editorPrevSrl); - var obj = editorGetIFrame(editorPrevSrl) - editorReplaceHTML(obj, html); - editorFocus(editorPrevSrl); - } -} - function editorInsertQuotation(html) { if(!html) return; @@ -387,7 +394,7 @@ function editorHighlight(ret_obj, response_tags, obj) { } /** - * iframe 드래그 관련 + * iframe 세로 크기 조절 드래그 관련 **/ var editorDragObj = {isDrag:false, y:0, obj:null, id:'', det:0} xAddEventListener(document, 'mousedown', editorDragStart);