cheditor를 코멘트에 적용했는데... 수정할 때 높이를 늘려주는게 안되네요. ㅠ.ㅠ... > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

cheditor를 코멘트에 적용했는데... 수정할 때 높이를 늘려주는게 안되네요. ㅠ.ㅠ... 정보

cheditor를 코멘트에 적용했는데... 수정할 때 높이를 늘려주는게 안되네요. ㅠ.ㅠ...

본문

코드를 자세히 보니까 엔터키가 들어가면 아래와 같이 편집기의 높이가 변경됩니다.

editArea.style.height = oEditor.document.body.scrollHeight+40+'px';

편집기를 불러서 사용하는 코드에서는 아래와 같이 에디터를 reset 합니다.

(원본)
function editorReset () {
editor.setEditorOpt();
editor.editArea.focus();
}

(수정본)
function editorReset () {

// 로직만 있고 오류가 나오는 코드입니다.
var areaHeight = parseInt(document.getElementById('wr_content').scrollHeight);
if (areaHeight < 200)
editor.style.height = 200+'px';
else
editor.style.height = document.getElementById('wr_content').scrollHeight+30+'px';

editor.setEditorOpt();
editor.editArea.focus();
}

이경우 어떻게 해야 할까요???



comment.js에서...

doOnKeyPress : function () {
var oEditor = document.getElementById("id"+chutil.oname).contentWindow;
var editArea = document.getElementById("id"+chutil.oname);
var areaHeight = parseInt(editArea.style.height);
var key = oEditor.event.keyCode;

if (key) {
if (key == 13) {
if (GB.autoHeight && oEditor.document.body.scrollHeight+40 > areaHeight)
editArea.style.height = oEditor.document.body.scrollHeight+40+'px';
if (GB.MSIE && oEditor.event.shiftKey == false) {
var sel = oEditor.document.selection.createRange();
oEditor.event.returnValue = false;
oEditor.event.cancelBubble = true;
sel.pasteHTML('<br />');
sel.select();
sel.moveEnd("character", 1);
sel.moveStart("character", 1);
sel.collapse(false);
return false;
}
else
return oEditor.event.keyCode = 13;
}
if (GB.autoHeight && (key == 8 || key == 46) && oEditor.document.body.scrollHeight+30 < areaHeight)
editArea.style.height = oEditor.document.body.scrollHeight+30+'px';
}
},

댓글 전체

전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

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