비

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

· 2024-02-28 (수) 22:37:19 · 3779 · 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개

감사 합니다.

2024-02-29 (목) 17:35:21

@들레아빠 감사합니다

감사합니다.

2024-02-29 (목) 18:41:09

@트리플 감사합니다 

2024-03-13 (수) 20:05:35

그런데 

 

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번 위치부터 한줄한줄 넣어봐도 만만세는 커녕 개미한마리 안보이는데요? ㅎ

2024-03-15 (금) 00:06:59

@뽕엄능브라

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

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

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

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

2024-03-15 (금) 01:01:44

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

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

그누보드5 팁자료실

2,788건
+
제목 글쓴이 날짜 조회
24-03-27 조회 3,759
24-03-27 조회 4,363
24-03-22 조회 3,426
24-03-19 조회 3,030
24-03-19 조회 8,950
24-03-15 조회 3,882
24-03-15 조회 3,404
24-03-15 조회 3,262
24-03-15 조회 3,276
24-03-13 조회 3,904
24-03-05 조회 3,364
24-03-01 조회 3,350
24-02-29 조회 5,436
24-02-29 조회 4,548
24-02-28 조회 3,780
24-02-27 조회 3,912
24-02-24 조회 3,454
24-02-18 조회 4,120
24-02-17 조회 3,117
24-02-15 조회 3,455
24-02-14 조회 2,935
24-02-13 조회 6,279
24-02-05 조회 3,665
24-01-31 조회 3,810
24-01-30 조회 3,147
24-01-30 조회 3,776
24-01-27 조회 3,649
24-01-18 조회 4,213
24-01-18 조회 3,605
24-01-17 조회 3,088