[javascript] CKEditor 이미지 팝업 커스텀

2015. 12. 16. 14:13프로그래밍/Javascript

    목차

쓰잘때기 없는 항목들 다 제거하고 싶을때
config.js에
다음 내용을 추가한다.

CKEDITOR.on( 'dialogDefinition', function( ev ){
    // Take the dialog name and its definition from the event data.
    var dialogName = ev.data.name;
    var dialogDefinition = ev.data.definition;
    // Check if the definition is from the dialog we're
    // interested in (the 'image' dialog). This dialog name found using DevTools plugin
    if ( dialogName == 'image' ){
        // Remove the 'Link' and 'Advanced' tabs from the 'Image' dialog.
        dialogDefinition.removeContents( 'Link' );    //링크 탭 제거
        dialogDefinition.removeContents( 'advanced' );  //상세정보 탭 제거

        // Get a reference to the 'Image Info' tab.
        var infoTab = dialogDefinition.getContents( 'info' );  //info탭을 제거하면 이미지 업로드가 안된다.
        // Remove unnecessary widgets/elements from the 'Image Info' tab.
        infoTab.remove( 'txtHSpace'); //info 탭 내에 불필요한 엘레멘트들 제거
        infoTab.remove( 'txtVSpace');
        infoTab.remove( 'txtBorder');
        infoTab.remove( 'txtWidth');
        infoTab.remove( 'txtHeight');
        infoTab.remove( 'ratioLock');
    }
});

제거 하고자 하는 엘레멘트의
ID가 궁굼하다면
ckeditor/_source/plugins/image/dialogs/image.js
를 까서 확인해보면
486 라인 이하에 리터럴 형식으로 정의 되어 있다
ID 참고하여 제거하자.