에디터 기본 설정 수정

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4802 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2008-11-07 11:52:49 +00:00
parent 189785a312
commit a7c17ca222
3 changed files with 52 additions and 78 deletions

View file

@ -212,15 +212,13 @@ a.skipToolBox:active span{ width:auto; height:auto; padding:3px 15px; font-weigh
.xeEditor .editorBox .editorMargin{ margin:0 5px;} .xeEditor .editorBox .editorMargin{ margin:0 5px;}
/* Editor Display */ /* Editor Display */
.xeEditor .toolBox, .xeEditor .toolBox, .xeEditor .richEditor, .xeEditor .htmlEditor {display:none;}
.xeEditor .richEditor, .xeEditor.rich .toolBox, .xeEditor.rich .richEditor, .xeEditor.html .htmlEditor{ display:block;}
.xeEditor .htmlEditor{ display:none;} .xeEditor.preview .toolBox, .xeEditor.rich .xeEditor.html .htmlEditor { display:none;}
.xeEditor.rich .toolBox, .xeEditor.preview .previewEditor { display:block;}
.xeEditor.rich .richEditor, .xeEditor .richEditor, .xeEditor .htmlEditor{ border:0;}
.xeEditor.html .htmlEditor{ display:block;}
.xeEditor .richEditor,
.xeEditor .htmlEditor{ border:0;}
.xeEditor .htmlEditor{ width:100%; padding:10px 0; font-size:12px;} .xeEditor .htmlEditor{ width:100%; padding:10px 0; font-size:12px;}
.xeEditor .previewEditor { display:none; }
/* Editor Resize Bar */ /* Editor Resize Bar */
.xeEditor .textAreaDragIndicator{ border-top:1px solid; border-bottom:1px solid; clear:both; margin-bottom:5px;} .xeEditor .textAreaDragIndicator{ border-top:1px solid; border-bottom:1px solid; clear:both; margin-bottom:5px;}

View file

@ -54,7 +54,7 @@
<!--@end--> <!--@end-->
<!--@end--> <!--@end-->
<li><a href="#" onclick="doDocumentPreview(this); return false;"><span>{$lang->cmd_preview}</span></a></li> <li id="preview_html_{$editor_sequence}"><a href="#htmlEditor" onclick="editorChangeMode('preview','{$editor_sequence}');"><span>{$lang->cmd_preview}</span></a></li>
</ul> </ul>
<!-- 에디터 --> <!-- 에디터 -->
@ -183,6 +183,7 @@
<div class="editorMargin" > <div class="editorMargin" >
<iframe id="editor_iframe_{$editor_sequence}" class="richEditor" frameborder="0" height="{$editor_height}" title="Rich Text Editor"></iframe> <iframe id="editor_iframe_{$editor_sequence}" class="richEditor" frameborder="0" height="{$editor_height}" title="Rich Text Editor"></iframe>
<textarea id="editor_textarea_{$editor_sequence}" class="htmlEditor" style="height:{$editor_height}" rows="5" cols="20" title="HTML Editor"></textarea> <textarea id="editor_textarea_{$editor_sequence}" class="htmlEditor" style="height:{$editor_height}" rows="5" cols="20" title="HTML Editor"></textarea>
<div id="editor_preview_{$editor_sequence}" class="previewEditor"></div>
</div> </div>
</div> </div>

View file

@ -17,6 +17,10 @@ function editorGetTextArea(editor_sequence) {
return xGetElementById( 'editor_textarea_' + editor_sequence ); return xGetElementById( 'editor_textarea_' + editor_sequence );
} }
function editorGetPreviewArea(editor_sequence) {
return xGetElementById( 'editor_preview_' + editor_sequence );
}
// editor_sequence에 해당하는 form문 구함 // editor_sequence에 해당하는 form문 구함
function editorGetForm(editor_sequence) { function editorGetForm(editor_sequence) {
var iframe_obj = editorGetIFrame(editor_sequence); var iframe_obj = editorGetIFrame(editor_sequence);
@ -197,7 +201,7 @@ function editorKeyPress(evt) {
if(!editor_sequence) return; if(!editor_sequence) return;
// IE에서 enter키를 눌렀을때 P 태그 대신 BR 태그 입력 // IE에서 enter키를 눌렀을때 P 태그 대신 BR 태그 입력
if (xIE4Up && !e.ctrlKey && !e.shiftKey && e.keyCode == 13 && editorMode[editor_sequence]!='html') { if (xIE4Up && !e.ctrlKey && !e.shiftKey && e.keyCode == 13 && !editorMode[editor_sequence]) {
var iframe_obj = editorGetIFrame(editor_sequence); var iframe_obj = editorGetIFrame(editor_sequence);
if(!iframe_obj) return; if(!iframe_obj) return;
@ -252,7 +256,7 @@ function editorKeyPress(evt) {
if(!iframe_obj) return; if(!iframe_obj) return;
// html 에디터 모드일 경우 이벤트 취소 시킴 // html 에디터 모드일 경우 이벤트 취소 시킴
if(editorMode[editor_sequence]=='html') { if(editorMode[editor_sequence]) {
evt.cancelBubble = true; evt.cancelBubble = true;
evt.returnValue = false; evt.returnValue = false;
xPreventDefault(evt); xPreventDefault(evt);
@ -343,7 +347,7 @@ function editorDo(command, value, target) {
} }
var editor_sequence = doc.body.getAttribute('editor_sequence'); var editor_sequence = doc.body.getAttribute('editor_sequence');
if(editorMode[editor_sequence]=='html') return; if(editorMode[editor_sequence]) return;
// 포커스 // 포커스
if(typeof(target)=="object") target.focus(); if(typeof(target)=="object") target.focus();
@ -399,80 +403,60 @@ function editorChangeMode(mode, editor_sequence) {
if(!iframe_obj) return; if(!iframe_obj) return;
var textarea_obj = editorGetTextArea(editor_sequence); var textarea_obj = editorGetTextArea(editor_sequence);
xWidth(textarea_obj, xWidth(iframe_obj.parentNode)); var preview_obj = editorGetPreviewArea(editor_sequence);
xHeight(textarea_obj, xHeight(iframe_obj.parentNode));
var contentDocument = iframe_obj.contentWindow.document; var contentDocument = iframe_obj.contentWindow.document;
// html 편집 사용시 var html = null;
if(mode == 'html') { if(editorMode[editor_sequence]=='html') {
var html = contentDocument.body.innerHTML; html = textarea_obj.value;
} else if (editorMode[editor_sequence]=='preview') {
html = xInnerHtml(preview_obj);
} else {
html = contentDocument.body.innerHTML;
html = html.replace(/<br>/ig,"<br />\n"); html = html.replace(/<br>/ig,"<br />\n");
html = html.replace(/<br \/>\n\n/ig,"<br />\n"); html = html.replace(/<br \/>\n\n/ig,"<br />\n");
textarea_obj.value = html; }
// iframe_obj.parentNode.style.display = "none"; // html 편집 사용시
xGetElementById('xeEditor_'+editor_sequence).className = 'xeEditor html'; if(mode == 'html' && textarea_obj) {
textarea_obj.value = html;
xWidth(textarea_obj, xWidth(iframe_obj.parentNode));
xHeight(textarea_obj, xHeight(iframe_obj.parentNode));
editorMode[editor_sequence] = 'html'; editorMode[editor_sequence] = 'html';
xGetElementById('use_rich_'+editor_sequence).className = ''; if(xGetElementById('xeEditor_'+editor_sequence)) {
xGetElementById('use_html_'+editor_sequence).className = 'active'; xGetElementById('xeEditor_'+editor_sequence).className = 'xeEditor html';
xGetElementById('use_rich_'+editor_sequence).className = '';
xGetElementById('preview_html_'+editor_sequence).className = '';
xGetElementById('use_html_'+editor_sequence).className = 'active';
}
// 미리보기
} else if(mode == 'preview' && preview_obj) {
xInnerHtml(preview_obj, html);
xWidth(preview_obj, xWidth(iframe_obj.parentNode));
editorMode[editor_sequence] = 'preview';
if(xGetElementById('xeEditor_'+editor_sequence)) {
xGetElementById('xeEditor_'+editor_sequence).className = 'xeEditor preview';
xGetElementById('use_rich_'+editor_sequence).className = '';
xGetElementById('preview_html_'+editor_sequence).className = 'active';
xGetElementById('use_html_'+editor_sequence).className = '';
}
// 위지윅 모드 사용시 // 위지윅 모드 사용시
} else { } else {
var html = textarea_obj.value;
contentDocument.body.innerHTML = html; contentDocument.body.innerHTML = html;
// iframe_obj.parentNode.style.display = "block";
xGetElementById('xeEditor_'+editor_sequence).className = 'xeEditor rich';
editorMode[editor_sequence] = null; editorMode[editor_sequence] = null;
xGetElementById('use_rich_'+editor_sequence).className = 'active'; if(xGetElementById('xeEditor_'+editor_sequence)) {
xGetElementById('use_html_'+editor_sequence).className = ''; xGetElementById('xeEditor_'+editor_sequence).className = 'xeEditor rich';
xGetElementById('use_rich_'+editor_sequence).className = 'active';
xGetElementById('preview_html_'+editor_sequence).className = '';
xGetElementById('use_html_'+editor_sequence).className = '';
}
} }
} }
/*
function editorChangeMode(obj, editor_sequence) {
var iframe_obj = editorGetIFrame(editor_sequence);
if(!iframe_obj) return;
var textarea_obj = editorGetTextArea(editor_sequence);
xWidth(textarea_obj, xWidth(iframe_obj.parentNode));
xHeight(textarea_obj, xHeight(iframe_obj.parentNode));
var contentDocument = iframe_obj.contentWindow.document;
// html 편집 사용시
if(obj.checked || obj == 'html') {
var html = contentDocument.body.innerHTML;
html = html.replace(/<br>/ig,"<br />\n");
html = html.replace(/<br \/>\n\n/ig,"<br />\n");
textarea_obj.value = html;
iframe_obj.parentNode.style.display = "none";
textarea_obj.style.display = "block";
xGetElementById('xeEditorOption_'+editor_sequence).style.display = "none";
editorMode[editor_sequence] = 'html';
// 위지윅 모드 사용시
} else {
var html = textarea_obj.value;
contentDocument.body.innerHTML = html;
iframe_obj.parentNode.style.display = "block";
textarea_obj.style.display = "none";
xGetElementById('xeEditorOption_'+editor_sequence).style.display = "block";
editorMode[editor_sequence] = null;
}
}
*/
// Editor Info Close // Editor Info Close
function closeEditorInfo(editor_sequence) { function closeEditorInfo(editor_sequence) {
xGetElementById('editorInfo_'+editor_sequence).style.display='none'; xGetElementById('editorInfo_'+editor_sequence).style.display='none';
@ -488,15 +472,6 @@ function showEditorHelp(e,editor_sequence){
if(xGetElementById(oid).className =='helpList'){ if(xGetElementById(oid).className =='helpList'){
xGetElementById(oid).className = 'helpList open'; xGetElementById(oid).className = 'helpList open';
/*
if(e.pageX <= xWidth('helpList_'+editor_sequence)){
xGetElementById('helpList_'+editor_sequence).style.right='auto';
xGetElementById('helpList_'+editor_sequence).style.left='0';
}else{
xGetElementById('helpList_'+editor_sequence).style.right='0';
xGetElementById('helpList_'+editor_sequence).style.left='';
}
*/
}else{ }else{
xGetElementById(oid).className = 'helpList'; xGetElementById(oid).className = 'helpList';
} }