FCKEDITOR 의 고급 기능 과 흔 한 문제 해결 방법

그것 은 PHP,자바 스 크 립 트,ASP.NET,ColdFusion,자바,그리고 ABAP 등 서로 다른 프로 그래 밍 언어 와 결합 할 수 있다.FCK 의 설정 과 사용 은 매우 간단 하지만 기본 설정 은 모든 수 요 를 만족 시 킬 수 없 기 때문에 우 리 는 FCK 의 고급 기능 을 알 아야 한다.FCK 의 인 스 턴 스 를 가 져 오 는 FCKeditorAPI 는 FCKeditor 를 불 러 온 후 등 록 된 전역 대상 입 니 다.이 를 이용 하면 편집기 에 대한 다양한 작업 을 수행 할 수 있 습 니 다.현재 페이지 에서 FCK 편집기 인 스 턴 스 를 가 져 옵 니 다:var Editor=FCKeditorAPI.GetInstance('InstanceName');FCK 편집기 팝 업 창 에서 FCK 편집기 인 스 턴 스 를 가 져 옵 니 다:var Editor=window.parent.InnerDialogLoaded().FCK;프레임 페이지 의 하위 프레임 에서 다른 하위 프레임 워 크 의 FCK 편집기 인 스 턴 스 를 가 져 옵 니 다:var Editor=window.FrameName.FCKeditorAPI.GetInstance('InstanceName');페이지 팝 업 창 에서 부모 창의 FCK 편집기 인 스 턴 스 를 가 져 옵 니 다:var Editor=opener.FCKeditorAPI.GetInstance('InstanceName');FCK 초점 가 져 오기 초점 이 FCK 에 있 는 지 여부:oEditor.HasFocus FCK 초점 가 져 오기:oEditor.Focus();/FCK 의 내용 을 가 져 오고 설정 하여 FCK 편집기 의 내용 을 가 져 옵 니 다:oEditor.GetXHTML(formatted);/formatted:true|false 로 HTML 형식 으로 꺼 낼 지 여 부 를 표시 합 니 다.FCK 편집기 의 내용 설정:oEditor.SetHTML("content",false);/두 번 째 매개 변 수 는 true|false 입 니 다.보 이 는 대로 내용 을 설정 하 시 겠 습 니까?FCK 편집기 에 내용 삽입:oEditor.InsertHtml("html");/"html"HTML 텍스트 를 위해 FCK 편집기 내용 에 변화 가 있 는 지 확인:oEditor.IsDirty();
 
// HTML
function getEditorHTMLContents(EditorName) {
var oEditor = FCKeditorAPI.GetInstance(EditorName);
return(oEditor.GetXHTML(true));
}

//
function getEditorTextContents(EditorName) {
var oEditor = FCKeditorAPI.GetInstance(EditorName);
return(oEditor.EditorDocument.body.innerText);
}

//
function SetEditorContents(EditorName, ContentStr) {
var oEditor = FCKeditorAPI.GetInstance(EditorName) ;
oEditor.SetHTML(ContentStr) ;
}
FCK 의 이벤트 처리 FCK 는 OnComplete,OnBlur,OnFocus 등 이 벤트 를 정의 하여 이벤트 의 처리 함 수 를 사용 하여 해당 하 는 처 리 를 완성 할 수 있다.FCK 에 이벤트 처리 함 수 를 추가 하 는 방법 은 fckInstance.Events.AttachEvent(EventName,function)코드
 
//FCKeditor
function FCKeditor_OnComplete( editorInstance )
{
editorInstance.Events.AttachEvent( 'OnBlur' , FCKeditor_OnBlur ) ;
editorInstance.Events.AttachEvent( 'OnFocus', FCKeditor_OnFocus ) ;
}
function FCKeditor_OnBlur( editorInstance )
{
//
editorInstance.ToolbarSet.Collapse() ;
}
function FCKeditor_OnFocus( editorInstance )
{
editorInstance.ToolbarSet.Expand() ;
}
입 니 다.

좋은 웹페이지 즐겨찾기