공개자료실_o

summernote 0.90 그누보드 웨지익 에디터 설치방법 및 호환설정 폰트 적용 방법 > 2025_1108_1434_16

작성자 정보

  • 최고관리자 작성
  • 192.♡.0.1 아이피
  • 작성일

컨텐츠 정보


  • 링크

  • 첨부


  • 본문

    summernote 0.90  그누보드 웨지익 에디터  설치방법 및 호환설정  폰트 적용 방법 > 2025_1108_1434_16


    https://www.11q.kr/bbs/board.php?bo_table=sw_free&wr_id=15

    제목: 그누보드 웨지익 에디터 찾기/바꾸기메뉴) summernote-master_11q_0.90\config.js


    gnuboard 의 설정

    > plugin/editor/ 디렉토리에 summernote 이름으로 넣어주세요.

    summernote  원본 소스 업데이트는

    w:\g5\plugin\editor\summernote-master_11q_0.90\summernote\
    에 원본을 복사 업데이트 하세요

    * 그누보드 플러그인 에디터 설정 사용

    [관리자 모드 > 환경 설정 > 기본 환경 설정] 메뉴의 [홈페이지 기본환경 설정 > 에디터 선택] 에서

    summernote 를 선택 각각의 게시판 보드 설정에 에디터 적용 

    
    * 지원 기능 특징 > 반응형 에디터에 최적 사용 추천 합니다
    - summernote 기본 기능
    - drag&drop 형태로 Image Upload 지원 
    - video 태그 입력 플러그인


    * 이미 bootstrap css 를 사용하는 경우
      editor.lib.php  에서 사용하지 않는 css 를  수정 해주시면 됩니다.

    summernote 구성 방법 파일 구성
    기본 그누보그 썸머노트 플러그인  다운로드
    https://github.com/easylogic/gnuboard5-summernote
    3232235521_1762577975.9928.png

    그누보드 에 설치
    w:\g5\plugin\editor\summernote-master_11q_0.90\

    3232235521_1762577521.6663.png

    업데이트 방법

    w:\g5\plugin\editor\summernote-master_11q_0.90\summernote\ 폴더에 붙여 널기 합니다
    https://summernote.org/getting-started/
    3232235521_1762577627.8942.png
    여기는 조금 늦은 업데이트 되어 github 애서 다운로드 합니다
     
    https://github.com/summernote/summernote
    3232235521_1762577802.8296.png

    3232235521_1762578202.7282.png

    3232235521_1762578498.8277.png

    복사후 사용 가능 

    3232235521_1762577749.1942.png


    아래 내용은 최종 파일 첨부 참조 하세요
    w:\g5\plugin\editor\summernote-master_11q_0.90_find (2).7z

    config.js 중요 변경 >

     // 한글 폰트및 클립보드 이미지 이중 삽입 방지
    w:\g5\plugin\editor\summernote-master_11q_0.90\config.js
    (function ($) {
      $(document).ready(function () {

        /** summernote start */
        $(".summernote").summernote({
          lang: 'ko-KR',
          height: 300,
          dialogsInBody: true,

          fontNames: ['맑은 고딕', '굴림', '돋움', '바탕', '궁서', 'Arial', 'Courier New', 'Comic Sans MS', 'Impact', 'Tahoma', 'Times New Roman', 'Verdana'],
          fontNamesIgnoreCheck: ['맑은 고딕', '굴림', '돋움', '바탕', '궁서'],

          // toolbar 설정
          toolbar: [
            ['style', ['style']],
            ['font', ['bold', 'italic', 'underline', 'strikethrough', 'superscript', 'subscript', 'clear']],
            ['fontname', ['fontname']],
            ['fontsize', ['fontsize']],
            ['color', ['color']],
            ['para', ['ul', 'ol', 'paragraph']],
            ['height', ['height']],
            ['table', ['table']],
            ['insert', ['link', 'picture', 'video']],
            ['view', ['fullscreen', 'codeview']],
            ['help', ['help']]
          ],

          callbacks: {
            onImageUpload: function (files) {
              /** upload start */
              var maxSize = 100 * 1024 * 1024; // limit 100MB
              var isMaxSize = false;
              var maxFile = null;
              for (var i = 0; i < files.length; i++) {
                if (files[i].size > maxSize) {
                  isMaxSize = true;
                  maxFile = files[i].name;
                  break;
                }
              }

              if (isMaxSize) {
                alert('[' + maxFile + '] 파일이 업로드 용량(100MB)을 초과하였습니다.');
              } else {
                for (var i = 0; i < files.length; i++) {
                  sendFile(files[i], this);
                }
              }
              /** upload end */
            },

            // 클립보드 이미지 이중 삽입 방지
            onPaste: function (e) {
              var clipboardData = e.originalEvent.clipboardData;
              if (clipboardData && clipboardData.items && clipboardData.items.length) {
                var items = clipboardData.items;
                for (var i = 0; i < items.length; i++) {
                  if (items[i].type.indexOf("image") !== -1) {
                    e.preventDefault(); // 기본 base64 삽입 차단
                  }
                }
              }
            }
          }
        });

        /** ???? Bootstrap5 + summernote-lite용 fullscreen 감시 코드 */
        const observer = new MutationObserver(function (mutations) {
          mutations.forEach(function (mutation) {
            if (mutation.attributeName === "class") {
              const editor = $(mutation.target);
              if (editor.hasClass('fullscreen')) {
                // 전체화면 진입
                $('body').addClass('note-fullscreen-mode');
                editor.css({
                  'z-index': '2147483647',
                  'position': 'fixed',
                  'top': 0,
                  'left': 0,
                  'width': '100%',
                  'height': '100%'
                });
              } else {
                // 전체화면 해제
                $('body').removeClass('note-fullscreen-mode');
                editor.removeAttr('style');
              }
            }
          });
        });

        // 에디터 생성 후 감시 시작
        $('.note-editor').each(function () {
          observer.observe(this, { attributes: true });
        });

      });
    })(jQuery);

    editor.lib.php 변경수정>

    bootstrap js 최신 버전으로 업데이트 합니다



    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
    <link rel="stylesheet" href="<?php echo $editor_url ?>/summernote/summernote-lite.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css" integrity="sha512-SnH5WK+bZxgPHs44uWIX+LLMD/cdL5xQp49lQ0w/R7p4T8s1vJv8W9L5aE2N2R5P6K9K5g+3b8p/B2oXw6A==" crossorigin="anonymous" referrerpolicy="no-referrer" />
    <link rel="stylesheet" href="<?php echo $editor_url ?>/style.css">
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
    <script src="<?php echo $editor_url ?>/summernote/summernote-lite.min.js"></script>
    <script src="<?php echo $editor_url ?>/summernote/lang/summernote-ko-KR.min.js"></script>
    <script type="text/javascript">

    관련전체 소스 editor.lib.php


    W:\g5\plugin\editor\summernote-master_11q_0.90\editor.lib.php

    <?php
    if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
    function editor_html($id, $content, $is_dhtml_editor=true)
    {
        global $g5, $config;
        static $js = true;
        $editor_url = G5_EDITOR_URL.'/'.$config['cf_editor'];
        $html = "";
        $html .= "<span class=\"sound_only\">Summernote 시작</span>";
    if ($is_dhtml_editor && $js) {
            ob_start();
    ?>
    <!-- <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
    <link rel="stylesheet" href="<?php echo $editor_url ?>/summernote/summernote.css">
    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.css">
    <script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js"></script>
    <script src="<?php echo $editor_url ?>/summernote/summernote.min.js"></script>
    <script src="<?php echo $editor_url ?>/summernote/lang/summernote-ko-KR.js"></script>
    <script type="text/javascript"> -->
    <!-- <link href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="<?php echo $editor_url ?>/summernote/summernote.css">
    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.css">
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
    <script src="<?php echo $editor_url ?>/summernote/summernote.min.js"></script>
    <script src="<?php echo $editor_url ?>/summernote/lang/summernote-ko-KR.js"></script>
    <script type="text/javascript"> -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
    <link rel="stylesheet" href="<?php echo $editor_url ?>/summernote/summernote-lite.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css" integrity="sha512-SnH5WK+bZxgPHs44uWIX+LLMD/cdL5xQp49lQ0w/R7p4T8s1vJv8W9L5aE2N2R5P6K9K5g+3b8p/B2oXw6A==" crossorigin="anonymous" referrerpolicy="no-referrer" />
    <link rel="stylesheet" href="<?php echo $editor_url ?>/style.css">
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
    <script src="<?php echo $editor_url ?>/summernote/summernote-lite.min.js"></script>
    <script src="<?php echo $editor_url ?>/summernote/lang/summernote-ko-KR.min.js"></script>
    <script type="text/javascript">
    // ... (나머지 sendFile 함수 및 JS 코드는 유지됩니다.)
    function sendFile(file, editor) {
        data = new FormData();
        data.append("SummernoteFile", file);
        $.ajax({
           data: data,
           type: "POST",
           url: "<?php echo $editor_url ?>/upload.php",
           cache: false,
           contentType: false,
           processData: false,
           success: function(data) {
             var obj =  JSON.parse(data);
             if (obj.success) {
                 $(editor).summernote("insertImage", obj.save_url);
             } else {
                switch(parseInt(obj.error)) {
                    case 1: alert('업로드 용량 제한에 걸렸습니다.'); break; 
    case 2: alert('MAX_FILE_SIZE 보다 큰 파일은 업로드할 수 없습니다.'); break;
    case 3: alert('파일이 일부분만 전송되었습니다.'); break;
    case 4: alert('파일이 전송되지 않았습니다.'); break;
    case 6: alert('임시 폴더가 없습니다.'); break;
    case 7: alert('파일 쓰기 실패'); break;
    case 8: alert('알수 없는 오류입니다.'); break;
                    case 100: alert('이미지 파일이 아닙니다.(jpeg, jpg, gif, bmp, png 만 올리실 수 있습니다.)'); break; 
                    case 101: alert('이미지 파일이 아닙니다.(jpeg, jpg, gif, bmp, png 만 올리실 수 있습니다.)'); break; 
                    case 102: alert('0 byte 파일은 업로드 할 수 없습니다.'); break; 
                }
             }
           }
       });
    }
    </script>
    <script src="<?php echo $editor_url ?>/config.js"></script>
     
    <?php       
            $html .= ob_get_contents();
            ob_end_clean();
            $js = false;
        }
        $summernote_class = $is_dhtml_editor ? "summernote" : "";
        $html .= "\n<textarea id=\"$id\" name=\"$id\" class=\"$summernote_class\" >$content</textarea>";
        $html .= "\n<span class=\"sound_only\">Summernote 끝</span>";
        return $html;
    }

    // textarea 로 값을 넘긴다. javascript 반드시 필요
    function get_editor_js($id, $is_dhtml_editor=true)
    {
        if ($is_dhtml_editor) {
            return "var {$id}_editor_data = $('#{$id}').summernote('code');";
        } else {
            return "var {$id}_editor = document.getElementById('{$id}');\n";
        }
    }

    //  textarea 의 값이 비어 있는지 검사
    function chk_editor_js($id, $is_dhtml_editor=true)
    {
        if ($is_dhtml_editor) {
            return "if (!{$id}_editor_data) { alert(\"내용을 입력해 주십시오.\"); $('#{$id}').summernote('focus'); return false; }\n";
        } else {
            return "if (!{$id}_editor.value) { alert(\"내용을 입력해 주십시오.\"); {$id}_editor.focus(); return false; }\n";
        }
    }
    ?>


    <style.css 추가항목>

    css 원본 수정을 하지 않고 수정 추가작업으로 수정 합니다

    w:\g5\plugin\editor\summernote-master_11q_0.90\style.css
     /* style.css 파일 내용 (예시) */

    /* 전체화면 z-index 충돌 해결 */
    .note-editor.note-frame.fullscreen,
    .note-editor.note-airframe.fullscreen {
      position: fixed !important;
      top: 0 !important;
      left: 0 !important;
      width: 100% !important;
      height: 100% !important;
      background: #fff !important;
      z-index: 2147483647 !important; /* 브라우저 한계치 */
    }
    /* 리사이즈바 숨김 */
    .note-editor.note-frame.fullscreen .note-resizebar,
    .note-editor.note-airframe.fullscreen .note-resizebar {
      display: none !important;
    }
    /* Body 스크롤 차단 */
    body.note-fullscreen-mode {
      overflow: hidden !important;
    }

    /* ???? style.css 예시 */
    /* 에디터 기본 폰트 변경 */
    .note-editor.note-frame {
      font-family: 'Noto Sans KR', '맑은 고딕', sans-serif;
      font-size: 15px;
    }
    /* 제목 스타일 강조 */
    .note-toolbar .note-btn {
      font-weight: 600;
      border-radius: 6px;
    }
    /* 에디터 영역 padding 조정 */
    .note-editable {
      padding: 15px 20px;
      line-height: 1.7;
    }
    /* 이미지가 넘칠 때 반응형 처리 */
    .note-editable img {
      max-width: 100%;
      height: auto;
    }
    /* 툴바 색상 커스터마이징 */
    .note-toolbar {
      background: #f8f9fa;
      border-bottom: 1px solid #ddd;
    }
    /* 전체 border-radius 조정 */
    .note-editor {
      border-radius: 10px;
    }
    /*  */
    /* ???? Summernote 제목 크기 커스터마이징 */
    .note-editable h1 { font-size: 2.2em; font-weight: 700; margin: 0.6em 0; }
    .note-editable h2 { font-size: 1.8em; font-weight: 700; margin: 0.6em 0; }
    .note-editable h3 { font-size: 1.5em; font-weight: 600; margin: 0.6em 0; }
    .note-editable h4 { font-size: 1.3em; font-weight: 600; margin: 0.5em 0; }
    .note-editable h5 { font-size: 1.15em; font-weight: 500; margin: 0.4em 0; }
    .note-editable h6 { font-size: 1.0em; font-weight: 500; margin: 0.4em 0; }
    /* 제목과 본문 간격 조정 */
    .note-editable p {
      margin: 0.5em 0;
      line-height: 1.7;
    }
    /* 주) */
    /* // 그누보도 sumernote 제목1,2,,,폰트적용 스킨적용1
    // W:\g5\skin\board\BS4-Basic-Webzine_11q_pdf_php82\write.skin.php
    $write['wr_content'] = htmlspecialchars_decode($write['wr_content']);
    // 그누보도 sumernote 제목1,2,,,폰트적용 그누보도 sumernote 제목1,2,,,폰트적용 스킨적용1 */

    그누보드 스킨보드 설정>

    초기 제목1(h1),, 적용후 초기 입력시 적용후  수정시 적용 문제 대응



    3232235521_1762578854.7516.png

    /* // 그누보도 sumernote 제목1,2,,,폰트적용 스킨적용1
    // W:\g5\skin\board\BS4-Basic-Webzine_11q_pdf_php82\write.skin.php
    $write['wr_content'] = htmlspecialchars_decode($write['wr_content']);
    // 그누보도 sumernote 제목1,2,,,폰트적용 그누보도 sumernote 제목1,2,,,폰트적용 스킨적용1 */

    을 추가 합니다


    설정사례 일부 > summernote  폰트 적용 방법

    // [config.js 파일 내] .summernote({...}) 부분 수정


        $(".summernote").summernote({
          lang: 'ko-KR',
          height: 300,
          dialogsInBody : true,

          fontNames: ['맑은 고딕', '굴림', '돋움', '바탕', '궁서', 'Arial', 'Courier New', 'Comic Sans MS', 'Impact', 'Tahoma', 'Times New Roman', 'Verdana'],
         
          // ???????????? 이 옵션을 사용하여 체크 과정을 무시하고 이름이 보이도록 합니다.
          fontNamesIgnoreCheck: ['맑은 고딕', '굴림', '돋움', '바탕', '궁서'],
          // ???????????? 폰트 이름이 표시되지 않는 모든 폰트를 여기에 추가하세요.

          // toolbar

    3232235521_1762482540.5286.png

    end > 2025_1108_1428_08




    첨부 파일을 스킨보드에 구성 PDF보기( W:\g5\skin\board\BS4-Basic-Webzine_11q_pdf_php82\view.skin.php + view_pdf.php구성)



    관련자료

    댓글 3

    최고관리자님의 댓글

    • 최고관리자
    • 아이피 192.♡.0.1
    • 작성일
    summernote 0.90  그누보드 웨지익 에디터 및 호환설정  폰트 적용 방법
    > 2025_1108_1434_16

    최고관리자님의 댓글

    • 최고관리자
    • 아이피 192.♡.0.1
    • 작성일
    toolbar: [
            ['style', ['style']],
            ['font', ['bold', 'italic', 'underline', 'strikethrough', 'superscript', 'subscript', 'clear']],
            ['fontname', ['fontname']],
            ['fontsize', ['fontsize']],
            ['color', ['color']],
            ['para', ['ul', 'ol', 'paragraph']],
            ['height', ['height']],
            ['table', ['table']],
            ['insert', ['link', 'picture', 'video']],
            ['custom', ['findreplace']], // 🔹 툴바에 표시
            ['view', ['fullscreen', 'codeview']],
            ['edit', ['undo', 'redo']],
            ['help', ['help']]
          ],

    최고관리자님의 댓글

    • 최고관리자
    • 아이피 192.♡.0.1
    • 작성일
    https://www.11q.kr/bbs/board.php?bo_table=sw_free&wr_id=15
    제목: 그누보드 웨지익 에디터 찾기/바꾸기메뉴) summernote-master_11q_0.90\config.js

    최근글


    새댓글