c577c92ac718cf76e46f72ad1ee694235d7d3223.svn-base 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>CHEditor Demo</title>
  5. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6. <!-- cheidtor.js 파일의 위치를 지정합니다. -->
  7. <script type="text/javascript" src="../cheditor.js"></script>
  8. </head>
  9. <body>
  10. <h2 style="text-align: center">CHEditor Demo</h2>
  11. <script type="text/javascript">
  12. function doSubmit (theform)
  13. {
  14. // ---------------------------------------------------------------------------------
  15. // myeditor라는 이름은 현재 데모에서 만들어진 에디터 개체 이름입니다.
  16. //
  17. // myeditor.outputBodyHTML() 메서드를 호출하면 에디터에서 작성한 글 내용이
  18. // myeditor.inputForm 설정 옵션에 지정한 'fm_post' 폼 값에 자동으로 입력됩니다.
  19. //
  20. // outputBodyHTML: BODY 태그 안쪽 내용을 가져옵니다.
  21. // outputBodyText: BODY 태그 안쪽의 HTML 태그를 제외한 텍스트만을 가져옵니다.
  22. // inputLength: 입력한 텍스트 문자 수를 리턴합니다.
  23. // contentsLength: BODY 태그 안쪽의 HTML 태그를 포함한 모든 문자 수를 리턴합니다.
  24. // contentsLengthAll: HTML 문서의 모든 문자 수를 리턴합니다.
  25. alert(myeditor.outputBodyHTML());
  26. return false;
  27. }
  28. // 업로드한 이미지 정보를 얻는 예제입니다.
  29. function showImageInfo() {
  30. var data = myeditor.getImages();
  31. if (data == null) {
  32. alert('올린 이미지가 없습니다.');
  33. return;
  34. }
  35. for (var i=0; i<data.length; i++) {
  36. var str = '사진 URL: ' + data[i].fileUrl + "\n";
  37. str += '저장 경로: ' + data[i].filePath + "\n";
  38. str += '원본 이름: ' + data[i].origName + "\n";
  39. str += '저장 이름: ' + data[i].fileName + "\n";
  40. str += '사진 크기: ' + data[i].width + ' X ' + data[i].height + "\n";
  41. str += '파일 크기: ' + data[i].fileSize;
  42. alert(str);
  43. }
  44. }
  45. </script>
  46. <div style="width:80%; margin: 0 auto">
  47. <form method="post" name="theform" onsubmit="return doSubmit(this)">
  48. <textarea id="fm_post" name="fm_write"></textarea>
  49. <!-- 에디터를 화면에 출력합니다. -->
  50. <script type="text/javascript">
  51. var myeditor = new cheditor(); // 에디터 개체를 생성합니다.
  52. myeditor.config.editorHeight = '300px'; // 에디터 세로폭입니다.
  53. myeditor.config.editorWidth = '100%'; // 에디터 가로폭입니다.
  54. myeditor.inputForm = 'fm_post'; // 위에 있는 textarea의 id입니다. 주의: name 속성 이름이 아닙니다.
  55. myeditor.run(); // 에디터를 실행합니다.
  56. </script>
  57. <div style="text-align: center; margin-top: 20px">
  58. <input type="submit" value="글 가져오기" />
  59. <input type="button" value="이미지 정보" onclick="showImageInfo()" />
  60. </div>
  61. </form>
  62. </div>
  63. <p style="text-align: center">
  64. <span style="font-family: verdana; font-size: 12px; color: #666">
  65. Copyright ⓒ 1997-2019 by <b>CHCODE.</b> All right reserved.
  66. </span>
  67. </p>
  68. </body>
  69. </html>