참조 : https://xe1.xpressengine.com/forum/19684369


_comment.html 의 form 영역에 해당 코드를 추가한다.

<input type="hidden" name="content" id="html5" value="" />
<textarea id="editor_{$oDocument->document_srl}" class="commentEditor"></textarea>


해당 페이지 혹은 js를 로드하는 곳에 아래 script 를 추가한다

<script type="text/javascript">
    var editorRelKeys = new Array();
    function editorStartTextarea(editor_sequence, content_key, primary_key) {
        var obj = xGetElementById('editor_'+editor_sequence);
        obj.form.setAttribute('editor_sequence', editor_sequence);
        editorRelKeys[editor_sequence] = new Array();
        editorRelKeys[editor_sequence]["primary"] = obj.form[primary_key];
        editorRelKeys[editor_sequence]["content"] = obj.form[content_key];
        editorRelKeys[editor_sequence]["func"] = editorGetContentTextarea;
        var content = obj.form[content_key].value;
        content = content.replace(/<br([^>]*)>/ig,"\n");
        content = content.replace(/&lt;/g, "<");
        content = content.replace(/&gt;/g, ">");
        content = content.replace(/&quot;/g, '"');
        content = content.replace(/&amp;/g, "&");

        // obj.value = content;
        document.getElementById('html5').value = content;
    }
    function editorGetContentTextarea(editor_sequence) {
        var obj = xGetElementById('editor_'+editor_sequence);
        var content = obj.value.trim();
        content = content.replace(/&/g, "&amp;");
        content = content.replace(/</g, "&lt;");
        content = content.replace(/>/g, "&gt;");
        content = content.replace(/\"/g, "&quot;");
        content = content.replace(/(\r\n|\n)/g, "<br />");
        return content;
    }
</script>


 
댓글은 로그인 사용자만 작성 가능합니다. 로그인하기