스마트 에디터 기본 내용 질문이요 채택완료
관리자 페이지 게시판관리에서 글쓰기 기본 내용을 입력을 하면
스마트에디터에 기본으로 나오는 내용이 적용이되는데
에디터 클릭시 그 내용을 초기화 하고 싶은데 방법이 없을까요??
$('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개
자답입니다...
되도록이면 코어파일은 수정안할려고 했지만 이렇게하면되는거 같네요.
/plugin/editor/smarteditor2/config.js 파일에
fOnAppLoad에
</strong></p>
<p>var iframeE2 = $('iframe[src="' + g5_editor_url + '/SmartEditor2Skin.html"]').contents().find('iframe[name="se2_iframe"]').contents().find('.se2_inputarea');</p>
<p>$(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", [""]);
}
});</p>
<p><strong>
이런식으로 추가해서 해결한거 같습니다..
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
기본 내용으로 돌아간다는 건가요?
아님 완전히 비운다는 건가요?
write.skin.php 맨 마지막에 추가해 주셔요
</p>
<p><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></p>
<p>
기본 내용은 등록시에만(수정은 해당안됨) 되도록
추가해봤습니다
</p>
<p><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></p>
<p>
답변에 대한 댓글 5개
하지만 제가 원하는건 버튼을 따로 만드는게 아니라 기본내용이 있는 상태에서 스마트에디터 내용 쓰는 부분을 클릭했을 경우 내용이 사라지게 하는 방법이 필요한거라..ㅠㅠ
글을 어떻게 작성하죠???
포커스를 잃어버렸다
다시 에디터 내용을 클릭하면? 초기화...
포커스를 유지하기 위함인가요?
이를테면 시험볼 때 다른 사이트 참조 못하도록?
스마트에디터 config.js에 fOnAppLoad 이 부분에 추가해서 수정했습니다..
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
스킨파일에서 기본내용을 hidden으로 불러와서 그 부분과 비교했습니다.