스마트 에디터 기본 내용 질문이요

스마트 에디터 기본 내용 질문이요

QA

스마트 에디터 기본 내용 질문이요

본문

관리자 페이지 게시판관리에서 글쓰기 기본 내용을 입력을 하면

스마트에디터에 기본으로 나오는 내용이 적용이되는데

에디터 클릭시 그 내용을 초기화 하고 싶은데 방법이 없을까요??


$('iframe[src="<?php echo G5_URL; ?>/plugin/editor/smarteditor2/SmartEditor2Skin.html"]').contents().find('iframe[name="se2_iframe"]').contents().find('.se2_inputarea');

 

$(iframe1).on("click", function() {
    //oEditors.getById["wr_content"].exec("SET_IR", [""]);
    console.log("aaa");
});

 

글쓰기 스킨에서 이런식으로 그부분을 찾아서 클릭이벤트를 해도 실행이 안되네요.

이 질문에 댓글 쓰기 :

답변 2

기본 내용으로 돌아간다는 건가요?

아님 완전히 비운다는 건가요?

write.skin.php 맨 마지막에 추가해 주셔요

 


<script>
$(function() {
    var editorContentInitVal = $('#wr_content').val();
    var editorContentInitBtn = '';
    editorContentInitBtn += '<button type="button" class="editorContentInit btn_cke_sc" data-empty="true">비우기</button> ';
    editorContentInitBtn += editorContentInitVal ? '<button type="button" class="editorContentInit btn_cke_sc">초기화</button> ' : '';
    $('.wr_content.smarteditor2 .cke_sc').prepend(editorContentInitBtn);
    $(document).on('click', '.editorContentInit', function() {
        if (oEditors && confirm('정말로?')) {
            oEditors.getById['wr_content'].exec("SET_IR", [$(this).data('empty') ? "" : editorContentInitVal]);
        }
    });
});
</script>

 

 

기본 내용은 등록시에만(수정은 해당안됨) 되도록

추가해봤습니다

 


<script>
$(function() {
    var w = "<?php echo $w; ?>";
    var editorContentInitVal = w === "" ? $('#wr_content').val() : "";
    var editorContentInitBtn = '';
    editorContentInitBtn += '<button type="button" class="editorContentInit btn_cke_sc" data-empty="true">비우기</button> ';
    editorContentInitBtn += editorContentInitVal ? '<button type="button" class="editorContentInit btn_cke_sc">초기화</button> ' : '';
    $('.wr_content.smarteditor2 .cke_sc').prepend(editorContentInitBtn);
    $(document).on('click', '.editorContentInit', function() {
        if (oEditors && confirm('정말로?')) {
            oEditors.getById['wr_content'].exec("SET_IR", [$(this).data('empty') ? "" : editorContentInitVal]);
        }
    });
});
</script>
 

댓글 감사합니다^^
하지만 제가 원하는건 버튼을 따로 만드는게 아니라 기본내용이 있는 상태에서 스마트에디터 내용 쓰는 부분을 클릭했을 경우 내용이 사라지게 하는 방법이 필요한거라..ㅠㅠ

내용 쓰는 부분을 클릭하면 초기화되는데
글을 어떻게 작성하죠???
포커스를 잃어버렸다
다시 에디터 내용을 클릭하면? 초기화...
포커스를 유지하기 위함인가요?
이를테면 시험볼 때 다른 사이트 참조 못하도록?

자답입니다...

 

되도록이면 코어파일은 수정안할려고 했지만 이렇게하면되는거 같네요.

 

/plugin/editor/smarteditor2/config.js 파일에

fOnAppLoad에

 


var iframeE2 = $('iframe[src="' + g5_editor_url + '/SmartEditor2Skin.html"]').contents().find('iframe[name="se2_iframe"]').contents().find('.se2_inputarea');
$(iframeE2).click(function () {
    var wr_content_html = $("#wr_content").html().replace(/</g, "<").replace(/>/g, ">").replace(/(<([^>]+)>)/gi, "");
    var iframeE2_html = iframeE2.html().replace(/</g, "<").replace(/>/g, ">").replace(/(<([^>]+)>)/gi, "");
    if (wr_content_html == iframeE2_html) {
        oEditors.getById["wr_content"].exec("SET_IR", [""]);
    }
});

 

이런식으로 추가해서 해결한거 같습니다..

답변을 작성하시기 전에 로그인 해주세요.
전체 192
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT