일단 죄송합니다 ㅠㅜ 질문지침서가 있었군요ㅠㅠㅠ

동아리 게시판 관리 때문에 phpmyadmin만 잠깐 건드려본 초보입니다.

아래 그림에서 텍스트에디터의 빨간색 부분의 버튼을 클릭 시 글 작성이 완료되버리는 현상 때문에 여쭙게 되었습니다.

혼자 해결해보려고 했으나 전체 코드를 이해하질 못해서 해결이 안되는것 같습니다ㅠㅠ

전체 게시판에서 같은 현상이 발생하며 다른 브라우져와 다른 기기에서도 같은 현상이 발생합니다....

캡처3.PNG

 

말씀해주신 버튼 설정 문제는 원래 몇년간 작동하던 부분이기에

아마 다른 문제일지도 모르겠지만 그 부분도 찾아보도록 하겠습니다. 답변 감사합니다!

 

먼저 TextEditor코드 부분은 아래와 같이 작성되어 있습니다.

function initEditor() {
 var bHeader = "<style>P {margin-top:3px;margin-bottom:3px;margin-left:3;margin-right;3}</style>\n";
 iText.document.open();
 iText.document.write(bHeader);
 iText.document.close();
 iText.document.body.style.fontSize = "9pt";
 iText.document.body.style.fontFamily = "굴림";
}

function TextEditorEvent(){
if (TextEditor.event.button==2){

 var oSource = TextEditor.event.srcElement ;
    if (!oSource.isTextEdit)
        oSource = TextEditor.event.srcElement.parentTextEdit;

  var strValue = TextEditor.event.srcElement.tagName; //선택된 부분의 태그 종류
    if ((strValue == "IMG" || strValue == "HR") && oSource != null) {

        var oTextRange = oSource.createTextRange();
     }

  var selectedRange = TextEditor.document.selection.createRange();
  var edValue = selectedRange.htmlText;

 var strX = TextEditor.event.x;
 var strY = TextEditor.event.y+180;

 if (strValue == "IMG")
  strH = "180px";
 else if (strValue == "HR" || strValue == "TABLE")
  strH = "135px";
 else
  strH = "340px";

 var strParam = "dialogLeft:" + strX + ";dialogTop:" + strY + ";"
 strParam = strParam + "center:no;dialogWidth:150px; dialogHeight:" + strH + ";status:0;scroll:0; help:0;unadorned:yes;"
 }
}

 

그다음 버튼을 눌러서 디버거를 실행해서 눌러보면 토글 버튼의 경우 아래와 같이 'type'속성에서 에러가 발생하며

캡처1.PNG

일반 버튼의 경우 누르면 'createRange'속성을 가져올 수 없다고 나옵니다.

캡처.PNG

 

 

혹시 몰라서 전체 코드도 같이 올려놓겠습니다.

 

function loadTextToEditor() {
 init();
 TextEditor.document.body.innerHTML = document.all.tmpContent.value;
}

//초기화
function init() {
 TextEditor.document.onmousedown = new Function("TextEditorEvent()");
 iText = TextEditor;
 iText.document.designMode = "On";
 TextEditView.style.display="inline";
 initEditor();

 iText.document.body.innerHTML = "<P>&nbsp;</P>";
 bLoad = true;

}

//기존글을 불러와서 편집
/*
function Edit(){
 init();
 TextEditView.style.display="inline";
 TextEditor.document.body.innerHTML = document.all.tmpContent.value;
}
*/

//초기화면 스타일 설정
function initEditor() {
 var bHeader = "<style>P {margin-top:3px;margin-bottom:3px;margin-left:3;margin-right;3}</style>\n";
 iText.document.open();
 iText.document.write(bHeader);
 iText.document.close();
 iText.document.body.style.fontSize = "9pt";
 iText.document.body.style.fontFamily = "굴림";
}

function TextEditorEvent(){
if (TextEditor.event.button==2){

 var oSource = TextEditor.event.srcElement ;
    if (!oSource.isTextEdit)
        oSource = TextEditor.event.srcElement.parentTextEdit;

  var strValue = TextEditor.event.srcElement.tagName; //선택된 부분의 태그 종류
    if ((strValue == "IMG" || strValue == "HR") && oSource != null) {

        var oTextRange = oSource.createTextRange();
     }

  var selectedRange = TextEditor.document.selection.createRange();
  var edValue = selectedRange.htmlText;

 var strX = TextEditor.event.x;
 var strY = TextEditor.event.y+180;

 if (strValue == "IMG")
  strH = "180px";
 else if (strValue == "HR" || strValue == "TABLE")
  strH = "135px";
 else
  strH = "340px";

 var strParam = "dialogLeft:" + strX + ";dialogTop:" + strY + ";"
 strParam = strParam + "center:no;dialogWidth:150px; dialogHeight:" + strH + ";status:0;scroll:0; help:0;unadorned:yes;"
 }
}

/*수정 된 부분 */
//action event
/*
function check(param){
 if(document.write.html_check[0].checked){
  document.write.content.value = TextEditor.document.body.innerHTML;
  if( !document.write.content.value ){
   alert( "내용을 입력해주세요!^^");
   TextEditor.document.body.focus();
   return;
  }
 }else{
  document.write.content.value = document.write.html_body.value;
   if( !document.write.content.value ){
   alert( "내용을 입력해주세요!^^");
   document.write.html_body.focus();
   return;
  }
 }
 document.write.method='post';
 document.write.action=param;
 document.write.submit();
// document.write.enctype='multipart/form-data';
}
*/


//since 2002/03/17
function paste(param){
 TextEditor.focus();
 var sel = TextEditor.document.selection;
 if (sel!=null) {
  var rng = sel.createRange();
     if (rng!=null)
      rng.pasteHTML(param);
 }
}

//since 2002.4.20
// 2004/02/11 by Parania
// html편집으로 바꾸면 포커스가 제대로 안되고 글이 안보이는 문제 해결
function layer_change(hidden_key,view_key){

 document.all[hidden_key].style.display = "none";
 document.all[view_key].style.display = "block";

 if(hidden_key == "html_layer") {
  TextEditor.document.body.innerHTML = document.all.html_body.value;
  TextEditor.document.body.focus(); // 2004/02/11 by parania
 }
 else {
  document.all.html_body.value = TextEditor.document.body.innerHTML;
  document.all.html_body.focus(); // 2004/02/11 by parania
 }

}
/*수정 된 부분 */

function ButtonUp(param) {
 param.style.border="1px outset";
 param.style.background="#D4D4D4";
}

function ButtonOut(param) {
 param.style.border="";
 param.style.background="";

}
function MenuOver(param) {
 param.style.fontColor="white";
 param.style.backgroundColor="navy";
}

function MenuOut(param) {
 param.style.fontcolor="white";
 param.style.backgroundColor="#C0C0C0";
}


/*
* 2004/02/11 comment by parania
* 글꼴과 글자크기를 바꿀 경우 적용되는 함수
*/
/*
* 2004/02/11 modified by parania
* 선택부분이 없으면 메시지를 출력한다.
*/
function block_style(o, cmd) {

 if (TextEditor.document.selection.type == "None")
 {
  alert("먼저 스타일을 바꿀부분을 지정하세요.");
  return;
 }

 var ed=TextEditor.document.selection.createRange();
 ed.execCommand(cmd, false, o.value);
}

/*
* 2004/02/11 comment by parania
* 글꼴, 글자크기를 제외한 메뉴를 선택할 경우 적용되는 함수
*/
/*
* 2004/02/11 modified by parania
* 볼드, 이탤릭, 밑줄은 선택부분이 없으면 메시지를 출력한다.
*/
function SelectionCommand(Btn, cmd) {

 // 볼드, 이탤릭, 밑줄 변환인데 텍스트 선택이 없을경우
 if ((cmd == "Bold" || cmd == "Italic" || cmd == "Underline") && TextEditor.document.selection.type == "None")
 {
  alert("스타일을 바꿀 부분을 먼저 선택하세요.");
  return;
 }
 TextEditor.focus();
 var EdRange=TextEditor.document.selection.createRange();
 EdRange.execCommand(cmd);
}


/*
function ChFontColor(param,cmd){
 var ed
 ed = TextEditor.document.selection.createRange();
 ed.execCommand(cmd, false, param);
}*/
/** modified by neoburi-Inkuk*/

// 2004/02/11 modified by parania
// 선택이 없을 경우 메시지 출력
// 색깔 테이블 파일 변경(창크기도 변경)
function ChFontColor(cmd){

 if (TextEditor.document.selection.type == "None")
 {
  alert("먼저 색을 바꿀부분을 지정하세요.");
  return;
 }

 var ed
 var value = showModalDialog( "/htmleditor/include/selcolor.html",
                             "",
                             "font-family:Verdana; font-size:12;dialogWidth:25em; dialogHeight:36em;status:no;help:no;self-close:no" );
 if( value != null ){
  ed = TextEditor.document.selection.createRange();
  ed.execCommand(cmd, true, value);
 }
 TextEditor.document.body.focus();
}

function OpenWinInsertImage(URL) {
 var str;
 var scrWidth = (screen.availWidth / 2 ) - 200;
 var scrHeight = (screen.availHeight / 2) - 200;
 str="'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,";
 str=str+"width=400";
 str=str+",height=370',top="+scrHeight+",left="+scrWidth;
 wopen = window.open(URL,'remote',str);
}

 

제가 미진해서 간단한 문제인데도 해결을 못하고 있는지도 모르겠군요ㅠㅠㅠ

시간 들여 읽어주신 분들께 감사드리며 혹시 해결책을 제시해주시면 정말 감사하겠습니다ㅠㅠㅠㅠ

오늘 낮은 따뜻하다고 하니 점심 맛있게 드시길 바라며 좋은 하루 되시길 바랍니다^^.

  • ?
    • jimk
    • 질문기여자
    크롬에서도 에러로그가 뜨던데 조금있다 글 수정해서 그 로그도 올리도록 하겠습니다!!
  • profile

    우선 XE도 아닌 것 같고, DB(phpmyadmin)를 건드렸는데 자바스크립트 에러가 난다는 것도 이상하고, 대강 봐서는 에디터를 잘못 만들었다고밖에 생각할 수 없습니다. 글 작성이 완료되어 버린다고 하셨는데, 이 과정도 CMS에 따라 천차만별이고요. XE가 아니라면 접근 방식이 완전히 달라져야 합니다.

     

    최소한 phpmyadmin에서 뭘 어떻게 건드렸는지 정도는 자세히 설명해 주셔야 그나마 실마리가 보일 듯 합니다. 아무튼 이 커뮤니티에서 해결을 기대하기에는 많이 난감한 질문이네요.

  • ?
    • jimk
    • 질문기여자
    그렇군요ㅠㅜ.. 제가 아는게 부족해서 질문할 곳을 잘못 찾아왔나보군요ㅠㅠ... 답변 감사합니다.
    그리고 phpmyadmin에서 수정했던 사항은 게시판 추가가 필요해서 게시판 중 하나를 복사해서 생성했습니다. 문제가 있다는 것도 게시글을 작성하면서 안 사항이라 DB에 의해서 발생한 문제인지 아닌지도 모르는 상황입니다ㅠㅠ...모르는게 너무 많네요.. 죄송합니다...ㅠㅠ
  • ?
    제로보드4로 구성된 게시판인가요?
    간단하게 해결 안되시면 어떤 cms로 만들어졌는지 확인하시고
    xe로 마이그레이션 추천드려요.
    오래되서 보안상에 문제도 있고.. 겸사겸사 xe최신버전으로 이전 검토해보세요~
  • ?
    • jimk
    • 질문기여자
    오래되서 그런걸까요... 좀더 확인해보고 조금씩 공부해봐야겠네요!! 답변 감사합니다!!