테스트 사이트 - 개발 중인 베타 버전입니다

스마트에디터2 내용물 외부에서 바꾸기

· 1년 전 · 1658 · 7

write.skin.php 기준입니다. php 가 아니라 자바스크립트입니다.

스마트에디터는 아이프레임으로 불러오기 때문에 아이프레임 온로드 이후에 해당코드를 넣어야 합니다.

 

<script>
document.addEventListener("DOMContentLoaded", () => {
    wr_content.nextSibling.onload = function() {

        해당코드;
    }
});
</script>

 

----------

 

oEditors.getById["wr_content"].exec("SET_IR", [""]); 
// 에디터 내용 전부 삭제

 

oEditors.getById["wr_content"].exec("PASTE_HTML", ["그누보드 만만세"]); 
// 커서 위치에 그누보드 만만세 입력

 

oEditors.getById["wr_content"].getIR();
// 에디터의 현재 내용 얻기

 

----------


1) 현재 커서 위치에 유튜브를 넣으려면?
oEditors.getById["wr_content"].exec("PASTE_HTML", ["유튜브 아이프레임"]);

 

2) 내용물을 몽땅 지우고 유튜브를 넣으려면?

oEditors.getById["wr_content"].exec("SET_IR", ["유튜브 아이프레임"]);

 

3) 내용물을 유지시키면서 처움에 유튜브를 넣으려면?
saveData = oEditors.getById["wr_content"].getIR();
oEditors.getById["wr_content"].exec("SET_IR", ["유튜브 아이프레임" + saveData]);

 

4) 내용물을 유지시키면서 마지막에 유튜브를 넣으려면?
saveData = oEditors.getById["wr_content"].getIR();
oEditors.getById["wr_content"].exec("SET_IR", [saveData + "유튜브 아이프레임"]);

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

댓글 7개

1년 전

감사 합니다.

1년 전

@들레아빠 감사합니다

감사합니다.

1년 전

@트리플 감사합니다 

1년 전

그런데 

 

document.addEventListener("DOMContentLoaded", () => {

 

1번위치


    document.querySelector("#wr_content").style.height = "<?php echo $se2_height; ?>";
    document.querySelector("#commentEditor iframe").onload = function() {
        se2Custom = this["contentWindow"]["document"];
        se2Custom.querySelector("body").style.backgroundColor = "#ffffff";
        se2Custom.querySelector("#smart_editor2 .se2_text_tool .se2_multy").style.display = "<?php echo $upload_display; ?>";
        se2Custom.querySelector("#smart_editor2 #se2_iframe").onload = function() {
            this["contentWindow"]["document"].querySelector("body").insertAdjacentHTML("beforebegin", "<style>img { max-width:100%; }</style>");
        }
    }
} );
</script>
<!-- /wittazzurri_5 -->
 

 

    wr_content.nextSibling.onload = function() {

oEditors.getById["wr_content"].exec("PASTE_HTML", ["그누보드 만만세"]); 
    } 요거를

1번 위치부터 한줄한줄 넣어봐도 만만세는 커녕 개미한마리 안보이는데요? ㅎ

1년 전

@뽕엄능브라

write.skin.php 와 댓글란은 적용할 대상이 다른데 코멘트 영역에서 저걸 쓰면 개미가 아니라 박테리아 한마리도 나타나지 않는 것은 지극히 정상입니다.

그리고 이건 온클릭 같은 트리거를 거쳐야만 일어나고요.

에디터는 백퍼센트 자바스크립트이니 php 를 적용하는 방식과는 많이 다르죠.

애초에 제이쿼리 없는 바닐라로만 적용했으니 응용하고 싶다면 바닐라 즉 순수 자바스크립트의 알고리즘을 익히시길 권합니다.

1년 전

@비타주리 댓글에디터도 주시고 답변도 해주시고ㅎㅎ  감사합니다

게시글 목록

번호 제목
24149
24140
24133
24125
24119
24109
24105
24101
24093
24089
24077
24074
24071
24070
24067
24056
24050
24046
24043
24040
24037
24036
24035
24034
24021
24017
24005
24002
23990
23980