부트스트랩 모달에 스마트에디터를 넣었는데 활성화가 안됩니다

매출이 오르면 내리는 수수료! 지금 수수료센터에서 전자결제(PG)수수료 비교견적 신청해 보세요!
부트스트랩 모달에 스마트에디터를 넣었는데 활성화가 안됩니다

QA

부트스트랩 모달에 스마트에디터를 넣었는데 활성화가 안됩니다

본문

최상단에 에디터 관련된 정보를 불러오고

 

include_once(G5_EDITOR_LIB);
$editor_content_js = '';
if(!is_mobile() || defined('G5_IS_MOBILE_DHTML_USE') && G5_IS_MOBILE_DHTML_USE)
    $is_dhtml_editor_use = true;

// 모바일에서는 G5_IS_MOBILE_DHTML_USE 설정에 따라 DHTML 에디터 적용
if ($config['cf_editor'] && $is_dhtml_editor_use ) {
    $is_dhtml_editor = true;

    if(is_file(G5_EDITOR_PATH.'/'.$config['cf_editor'].'/autosave.editor.js'))
        $editor_content_js = '<script src="'.G5_EDITOR_URL.'/'.$config['cf_editor'].'/autosave.editor.js"></script>'.PHP_EOL;
}
$editor_html = editor_html('wr_content', $content, $is_dhtml_editor);
$editor_js = '';
$editor_js .= get_editor_js('wr_content', $is_dhtml_editor);
$editor_js .= chk_editor_js('wr_content', $is_dhtml_editor);

 

<div class="wr_content" style="height:400px;">
     <?=$editor_html?>
</div>

 

이렇게 넣어줬는데 아무것도 안나오길래 f12로 확인해보니까

height 가 0 으로 되있더라구요. 그래서 강제로 height를 주니까 나오긴하던데

1794815956_1563524437.8967.png

 

빨간색 부분 textarea 부분이 선택이 안되더라구요? 그래서 이것저것 눌러보다가

아래에 입력창 크기조절이나 html 모드를 누르니까 쓸수있게 바뀌던데 ㅠㅠ

 

또 개발자도구로 보니까

 

<iframe src="smart_editor2_inputarea.html" id="se2_iframe" name="se2_iframe" class="se2_input_wysiwyg" width="400" height="300" title="글쓰기 영역 : 도구 모음은 ALT+F10을, 도움말은 ALT+0을 누르세요." frameborder="0" style="display: block; height: 0px;"></iframe>

 

에디터 안에 들어가있는 이 iframe 이 보시는 것처럼 style이 height:0px으로 되있다가 위에 조절창이나 html모드 누를때 height 값이 320px으로 바뀌면서 활성화가 되더라구요?;;

 

이게 상위 height를 따라가는 것 같아서 위에도 다 height 값을 줘놨는데 ㅠㅠ

 

그리고 강제로 height 값을 주니까 안먹더라구요..

 

이게 그 실행시키는 함수?같은게 있나요? ㅠㅠ

 

요악

1. 스마트에디터를 활성화하는 방법이있을까요?

 

2. 아래는 문제의 소스입니다.

<?
include_once(G5_EDITOR_LIB);
$editor_content_js = '';
if(!is_mobile() || defined('G5_IS_MOBILE_DHTML_USE') && G5_IS_MOBILE_DHTML_USE)
    $is_dhtml_editor_use = true;

// 모바일에서는 G5_IS_MOBILE_DHTML_USE 설정에 따라 DHTML 에디터 적용
if ($config['cf_editor'] && $is_dhtml_editor_use ) {
    $is_dhtml_editor = true;

    if(is_file(G5_EDITOR_PATH.'/'.$config['cf_editor'].'/autosave.editor.js'))
        $editor_content_js = '<script src="'.G5_EDITOR_URL.'/'.$config['cf_editor'].'/autosave.editor.js"></script>'.PHP_EOL;
}
$editor_html = editor_html('wr_content', $content, $is_dhtml_editor);
$editor_js = '';
$editor_js .= get_editor_js('wr_content', $is_dhtml_editor);
$editor_js .= chk_editor_js('wr_content', $is_dhtml_editor);

if ($w == 'u') {
    $wr_content = get_text(html_purifier($write['wr_content']), 0);
}
?>
<!-- 기안서 등록 모달 -->
<div class="modal fade" id="insert_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="z-index:99999;">
    <form name="insert_form" id="insert_form" action="<?=G5_BBS_URL?>/money_list_insert.php" method="post">
        <input type="hidden" name="bo_url" value="<?=$_SERVER['REQUEST_URI'];?>">
        <input type="hidden" name="bo_table" id="bo_table" value="g5_money_list">
        <div class="modal-dialog modal-lg" id="sim_box">
            <div class="modal-content modal_60">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                </div>
                <!-- 게시물 작성/수정 시작 { -->
                <form name="fwrite" id="fwrite" action="<?php echo $action_url ?>" onsubmit="return fwrite_submit(this);" method="post" enctype="multipart/form-data" autocomplete="off" style="width:<?php echo $width; ?>">
                <div class="modal-body">
                    <br />
                    <input type="hidden" name="uid" value="<?php echo get_uniqid(); ?>">
                    <input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">

                    <table class="table table-bordered">
                        <tr>
                            <th class="fill_color">양식명</th>
                            <td><input type="text" name="wr_subject" value="" id="wr_subject"></td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <div class="wr_content" style="height:400px;">
                                <?=$editor_html?>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
                <div class="modal-footer">
                    <input type="button" value="버튼" onclick="pasteHTML();">
                    <button type="button" class="btn btn-info" id="btn-save" onclick="fwrite_submit();">신규등록</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">닫기</button>
                </div>
                </form>
            </div>
        </div>
    </form>
</div>

이 질문에 댓글 쓰기 :

답변 1

모달의 경우 부모가 실행되는 페이지에 대한 정보도 알려주시는게 좀 더 정확한 답변을 받아 보실 수 있으실겁니다.

 

만약 지금 모달을 실행하시는 부모페이지가 일반페이지라면 코드 작성이 잘못되었구요.

````

$editor_html = editor_html('wr_content', $content, $is_dhtml_editor);
$editor_js = '';
$editor_js .= get_editor_js('wr_content', $is_dhtml_editor);
$editor_js .= chk_editor_js('wr_content', $is_dhtml_editor);

````

이 부분에 대한 공부(?) 검색(?) 을 좀 더 하셔야 하실것으로 보여집니다.

세부적인 내용은 글몇자로 알려드리기에는 분량이.....

 

네이버 개발자 센터의 스마트에디터 예시를 참고하셔도 좋을거 같습니다.

아 죄송합니다ㅠㅠ

급한마음에 이것저것 테스트해본다고 소스가 뒤죽박죽이었네요 ㅠㅠ

$editor_html = editor_html('wr_content', $content, $is_dhtml_editor);

이거만 선언해서 아래와 같이 쓰고있습니다!

<div class="wr_content">
<?=$editor_html?>
</div>

모달이 열릴때 아래에 스마트에디터 불러오는 부분이 있길래 넣어주니 되더라구요.

function pasteHTML() {
//전역변수
var editor_object = [];

//스마트 에디터 생성 함수
nhn.husky.EZCreator.createInIFrame({
  oAppRef : editor_object,
  elPlaceHolder : "wr_content", // newContents 는 스마트에디터가 추가될 텍스트 에어리어
  sSkinURI : "<?=G5_PLUGIN_URL?>/editor/smarteditor2_responsive/SmartEditor2Skin.html",
  htParams : {
// 툴바 사용 여부 (true:사용/ false:사용하지 않음)
bUseToolbar : true,
// 입력창 크기 조절바 사용 여부 (true:사용/ false:사용하지 않음)
bUseVerticalResizer : false,
// 모드 탭(Editor | HTML | TEXT) 사용 여부 (true:사용/ false:사용하지 않음)
bUseModeChanger : true,
  }
});
}

저는 이렇게 말고 단순하게 그냥 smart() 이런식으로만 넣으면 되는게 있는지 궁금합니다ㅠㅠ

답변을 작성하시기 전에 로그인 해주세요.
전체 1
QA 내용 검색

회원로그인

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