카이루

웹접근성심사 홈페이지를 위한 대체텍스트 alt 입력 기능

웹접근성 마크가 있는 홈페이지는 이미지에 대체텍스트(alt)를 입력해야 합니다.

장애인분들을 위해 필요한 내용이죠...

 

smartteditor2 게시판에 첨부한 분을 위해 간단한 소스 공유합니다.

 

예시 이미지입니다.

 

3731943363_1760421301.3798.png

 

/plugin/editor/smarteditor2/SmartEitor2Skin.html

아래 내용 추가하시면 됩니다.

[code]

<!-- SE2 Markup End -->
<script>
(function() {
    function attachImageAltEditor() {
        const iframe = document.getElementById("se2_iframe");
        if (!iframe) {
              return setTimeout(attachImageAltEditor, 500);
        }

        const editorDoc = iframe.contentDocument || iframe.contentWindow.document;
        if (!editorDoc || !editorDoc.body) {
            return setTimeout(attachImageAltEditor, 500);
        }

        // 중복 방지
        if (editorDoc.__altEventAttached) return;
        editorDoc.__altEventAttached = true;

        console.log("SmartEditor2 이미지 ALT 편집기 연결 완료");

        editorDoc.addEventListener("click", function(e) {
            const target = e.target;
            if (target.tagName === "IMG") {
                const currentAlt = target.getAttribute("alt") || "";
                const newAlt = prompt("이미지 대체텍스트(alt)를 입력하세요.", currentAlt);
                if (newAlt !== null) {
                    target.setAttribute("alt", newAlt.trim());
                }
            }
        });
    }

      setTimeout(attachImageAltEditor, 500);
})();
</script>
[/code]

댓글 3개

감사 합니다.

편하게 사용할 것 같습니다. 감사합니다. ^^
댓글을 작성하시려면 로그인이 필요합니다.
+
제목 글쓴이 날짜 조회
25-10-17 조회 5,837
25-10-15 조회 5,853
25-10-14 조회 5,883
25-10-14 조회 5,905
25-10-14 조회 7,398
25-10-13 조회 6,709
25-10-12 조회 6,666
25-10-12 조회 6,056
25-10-12 조회 6,081
25-10-10 조회 5,934
25-10-10 조회 5,519
25-10-09 조회 6,011
25-10-08 조회 5,612
25-10-02 조회 5,804
25-10-02 조회 6,154
25-10-01 조회 5,650
25-09-29 조회 5,732
25-09-25 조회 5,972
25-09-25 조회 6,599
25-09-22 조회 6,140
25-09-19 조회 6,081
25-09-19 조회 6,087
25-09-16 조회 5,633
25-09-16 조회 5,826
25-09-12 조회 6,064
25-09-11 조회 5,604
25-09-09 조회 5,901
25-09-09 조회 5,770
25-09-08 조회 5,804
25-09-06 조회 6,070