/** * @author zero (zero@nzeo.com) * @version 0.1 * @brief 에디터 관련 스크립트 **/ // iframe의 id prefix var iframe_id = 'editor_iframe_'; // upload_target_srl에 대한 form문을 객체로 보관함 var editor_form_list = new Array(); // upload_target_srl값에 해당하는 iframe의 object를 return function editorGetIFrame(upload_target_srl) { var obj_id = iframe_id+upload_target_srl; return xGetElementById(obj_id); } // editor 초기화를 onload이벤트 후에 시작시킴 function editorInit(upload_target_srl, resizable, height) { xAddEventListener(window, 'load', function() { editorStart(upload_target_srl, resizable, height); }); } // editor 시작 (upload_target_srl로 iframe객체를 얻어서 쓰기 모드로 전환) function editorStart(upload_target_srl, resizable, height) { if(typeof(height)=="undefined"||!height) height = 350; if(typeof(resizable)=="undefined"||!resizable) resizable = false; else resizable = true; // iframe_area를 찾음 var iframe_area = xGetElementById("editor_iframe_area_"+upload_target_srl); xInnerHtml(iframe_area, ""); // iframe obj를 찾음 var iframe_obj = editorGetIFrame(upload_target_srl); if(!iframe_obj) return; // 현 에디터를 감싸고 있는 form문을 찾아서 content object를 찾아서 내용 sync var fo_obj = iframe_obj.parentNode; while(fo_obj.nodeName != 'FORM') { fo_obj = fo_obj.parentNode; } // saved document에 대한 체크 if(typeof(fo_obj._saved_doc_title)!="undefined" ) { var saved_title = fo_obj._saved_doc_title.value; var saved_content = fo_obj._saved_doc_content.value; if(saved_title || saved_content) { if(confirm(fo_obj._saved_doc_message.value)) { fo_obj.title.value = saved_title; fo_obj.content.value = saved_content; } else { editorRemoveSavedDoc(); } } } // 구해진 form 객체를 저장 editor_form_list[upload_target_srl] = fo_obj; // 대상 form의 content object에서 데이터를 구함 var content = fo_obj.content.value; // iframe내의 document object var contentDocument = iframe_obj.contentWindow.document; // editing가능하도록 설정 시작 // 기본 내용 작성 var contentHtml = ''+ ''+ '
'+ ''+ ''+ ''+ ''+ content+ "\n"+ '