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';
}
},
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';
}
},
댓글 전체