From 1aee7c7b607b15ff9a4d8e048719197ad956f08a Mon Sep 17 00:00:00 2001 From: zero Date: Fri, 28 Sep 2007 03:54:44 +0000 Subject: [PATCH] =?UTF-8?q?=EC=97=90=EB=94=94=ED=84=B0=EC=9D=98=20DesignMo?= =?UTF-8?q?de=EB=A5=BC=20iframe=EC=97=90=20focus=EA=B0=80=20=EC=9D=BC?= =?UTF-8?q?=EC=96=B4=EB=82=A0=EB=95=8C=20=EC=9D=B4=EB=A3=A8=EC=96=B4?= =?UTF-8?q?=EC=A7=80=EB=8F=84=EB=A1=9D=20=EC=BD=94=EB=93=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD.=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EB=A1=9C=EB=94=A9?= =?UTF-8?q?=20=EC=86=8D=EB=8F=84=20=EC=A6=9D=EA=B0=80=20=EB=B0=8F=20?= =?UTF-8?q?=EC=97=90=EB=94=94=ED=84=B0=20=EB=B6=80=EB=B6=84=EC=9D=98=20dis?= =?UTF-8?q?play:none=EC=9D=BC=20=EA=B2=BD=EC=9A=B0=20=EB=8C=80=EB=B9=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2646 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/editor/tpl/editor.html | 162 -------------------------------- modules/editor/tpl/js/editor.js | 47 +++++---- 2 files changed, 29 insertions(+), 180 deletions(-) delete mode 100644 modules/editor/tpl/editor.html diff --git a/modules/editor/tpl/editor.html b/modules/editor/tpl/editor.html deleted file mode 100644 index 0251f9aa0..000000000 --- a/modules/editor/tpl/editor.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - - - - - - - -
- -
- -
-
-
- - - - - -
- -
- {$lang->edit->help_bold} - {$lang->edit->help_italic} - {$lang->edit->help_underline} - {$lang->edit->help_fontcolor} - {$lang->edit->help_fontbgcolor} -
-
- -
-
- {$lang->edit->help_align_left} - {$lang->edit->help_align_center} - {$lang->edit->help_align_right} - -
- - -
- - -
- - - -
-
-
- - - {$component->title} - - -
-
-
- -
- - -
- {$lang->about_dblclick_in_editor} - - close -
- - -
-
- -
-
 
-
- -
- -
- - - - - - - - -
- - diff --git a/modules/editor/tpl/js/editor.js b/modules/editor/tpl/js/editor.js index 5d1e2e4a7..bb17c0f7f 100755 --- a/modules/editor/tpl/js/editor.js +++ b/modules/editor/tpl/js/editor.js @@ -20,7 +20,6 @@ var editor_rel_keys = new Array(); ///< 에디터와 각 모듈과의 연동을 xAddEventListener(window, 'load', _editorSync); ///< 에디터의 동기화를 하는 함수를 window.load시 실행 - /** * 에디터의 상태나 객체를 구하기 위한 함수 **/ @@ -148,9 +147,15 @@ function editorStart(editor_sequence, primary_key, content_key, resizable, edito // iframe내의 document element를 구함 var contentDocument = iframe_obj.contentWindow.document; - /** - * 에디터를 위지윅 모드로 만들기 위해 내용 작성 후 designMode 활성화 - **/ + // 크기 변경 불가일 경우 드래그바 숨김 + if(resizable == false) xGetElementById("editor_drag_bar_"+editor_sequence).style.display = "none"; + else xGetElementById("editor_drag_bar_"+editor_sequence).style.display = "block"; + + // IE일 경우 ctrl-Enter 안내 문구를 노출 + if(xIE4Up && xGetElementById('for_ie_help_'+editor_sequence)) { + xGetElementById('for_ie_help_'+editor_sequence).style.display = "block"; + } + var contentHtml = ''+ ''+ ''+ @@ -165,15 +170,31 @@ function editorStart(editor_sequence, primary_key, content_key, resizable, edito content+ ''+ ''; + contentDocument.open("text/html","replace"); + contentDocument.write(contentHtml); + contentDocument.close(); + + // editor_mode를 기본으로 설정 + editor_mode[editor_sequence] = null; + + // iframe에 focus가 될때 에디터 모드로 전환하도록 이벤트 지정 + if(xIE4Up) xAddEventListener(iframe_obj, "focus", function() { editorSetDesignMode(iframe_obj, contentDocument, content, fo_obj, editor_sequence, editor_height); } ); + else xAddEventListener(iframe_obj.contentWindow, "focus", function() { editorSetDesignMode(iframe_obj, contentDocument, content, fo_obj, editor_sequence, editor_height); } ); +} + +/** + * 에디터를 위지윅 모드로 만들기 위해 내용 작성 후 designMode 활성화 + **/ +var editor_is_started = new Array(); +function editorSetDesignMode(iframe_obj, contentDocument, content, fo_obj, editor_sequence, editor_height) { + if(editor_is_started[editor_sequence]) return; + contentDocument.designMode = 'on'; try { contentDocument.execCommand("undo", false, null); contentDocument.execCommand("useCSS", false, true); } catch (e) { } - contentDocument.open("text/html","replace"); - contentDocument.write(contentHtml); - contentDocument.close(); /** * 더블클릭이나 키눌림등의 각종 이벤트에 대해 listener 추가 @@ -189,11 +210,6 @@ function editorStart(editor_sequence, primary_key, content_key, resizable, edito xAddEventListener(document,'mouseup',editorEventCheck); xAddEventListener(document,'mousedown',editorHideObject); - // IE일 경우 ctrl-Enter 안내 문구를 노출 - if(xIE4Up && xGetElementById('for_ie_help_'+editor_sequence)) { - xGetElementById('for_ie_help_'+editor_sequence).style.display = "block"; - } - /** * 에디터의 내용을 지속적으로 fo_obj.content의 값과 동기화를 시킴. * 차후 다른 에디터를 사용하더라도 fo_obj.content와 동기화만 된다면 어떤 에디터라도 사용 가능하도록 하기 위해 @@ -204,12 +220,7 @@ function editorStart(editor_sequence, primary_key, content_key, resizable, edito // 자동저장 필드가 있다면 자동 저장 기능 활성화 if(typeof(fo_obj._saved_doc_title)!="undefined" ) editorEnableAutoSave(fo_obj, editor_sequence); - // 크기 변경 불가일 경우 드래그바 숨김 - if(resizable == false) xGetElementById("editor_drag_bar_"+editor_sequence).style.display = "none"; - else xGetElementById("editor_drag_bar_"+editor_sequence).style.display = "block"; - - // editor_mode를 기본으로 설정 - editor_mode[editor_sequence] = null; + editor_is_started[editor_sequence] = true; }