본문 바로가기

나 어제 배웠다/Editor

FCKeditor 설치 및 설정

FCKeditor 설치 및 설정

 

FCKEditor 다운로드 : http://www.fckeditor.net/
2006년 5월 20일 현재 2.3 Beta 버젼은 에러가 있는거 같아서 2.2 로 사용중..

 

1. _sample 파일안에 샘플파일이 있는데 알맞은 파일을 사용하면 된다.

 

2. 적용페이지 상단에
 
<!--#include virtual="/FCKeditor/fckeditor.asp"-->
<!--#include file="./FCKeditor/fckeditor.asp"-->

 

와 같이 class 파일을 링크시켜준다

 

3. 페이지내의

 

<%@ CodePage=65001 Language="VBScript!"%>


<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

 

는 삭제. 페이지내에서 한글을 사용할 경우 에러발생

 

4. 내용 필수입력체크

 

function isNull( s ) { 
  if( s == null ) return true;

  var result = s.replace(/(^\s*)|(\s*$)/g, "");

  if( result ) 
    return false;
  else
    return true; 
}


function sendit(it) {
  var s = FCKeditor1___Frame.document.eEditorArea.document.body.innerText;

  if(isNull(s)) {
    alert!("내용을 입력하세요"); 
    FCKeditor1___Frame.focus(); 
    return false; 
  }
  document.form.submit.disabled = true;
}

 

<form name="form" method="post" action="query_ok.asp" target="_blank" [안내]태그제한으로등록되지않습니다-xx[안내]태그제한으로등록되지않습니다-xxonsubmit="return sendit(this);">
<input type="submit" name="submit" value="submit">
</form>

 

5. 업로드파일 경로설정

 

/FCKeditor/editor/filemanager/browser/default/connectors/asp/config.asp 파일 27번째줄

 

ConfigUserFilesPath = "/UserFiles/"
ConfigIsEnabled = False 을 True 로 설정


 

6. 툴바의 정리

 

fckconfig.js

파일에서 정리...

 

7. 에디터에서 엔터칠때 한줄만 내려가게 하려면..

 

- 전체적용

fckconfig.js 파일하단에..

FCKConfig.UseBROnCarriageReturn = true ; // IE only

true 로 설정

 

- 에디터별적용

Dim oFCKeditor
Set oFCKeditor = New FCKeditor
oFCKeditor.BasePath = "/FCKeditor/"
oFCKeditor.Value = ""
oFCKeditor.Config("UseBROnCarriageReturn") = True
oFCKeditor.Create "FCKeditor1"

 

와 같이 해당페이지에 추가한다..

 

8. FCKeditor 값 전송시 처리방법


replace함수를 써서 " -> '  으로 변환한다.
content = replace(Request.Form("FCKeditor1"),"""","'")

 

9. 전송받은 페이지에서 한글깨짐 처리방법


[%@ CodePage='949'  Language="VBScript!"%] 삽입

 

10. 폰트 크기 부분에 나타나는 내용 변경


FCKConfig.FontSizes  = '1/8pt;2/10pt;3/12pt;4/14pt;5/18pt;6/24pt;7/36pt';

 

11. 기본 언어 한글로 변경

 

FCKConfig.DefaultLanguage  = 'ko';

 

12. 에디터에서 기본 폰트를 변경

 

FCKeditor/editor/css/fck_editorarea.css 파일 안의

Body 부분 font-family 순서와 종류를 바꿈

 

13. 입력한 스크립트가 임의로 재정렬되지 않도록 아래 부분의 주석 처리 제거(언어별 주석체크해제)

 

FCKConfig.ProtectedSource.Add( /<script[\s\S]*?\/script>/gi ) ; // <SCRIPT> tags.


FCKConfig.ProtectedSource.Add( /<%[\s\S]*?%>/g ) ; // ASP style server side code <%...%>


FCKConfig.ProtectedSource.Add( /<\?[\s\S]*?\?>/g ) ; // PHP style server side code <?...?>


FCKConfig.ProtectedSource.Add( /(<asp:[^\>]+>[\s|\S]*?<\/asp:[^\>]+>)|(<asp:[^\>]+\/>)/gi ) ; // ASP.Net style tags <asp:control>

 

14. 이미지업로드시 한글파일깨짐방지

 

html 페이지에...
<meta http-equiv="Content-Language" content="ko">
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">

asp 페이지에...
Session.CodePage = 949 '한글 깨짐 방지
Response.ChaRset = "euc-kr" '한글 깨짐 방지