View

cheditor 글쓰기 오류

수퍼곰탱이 2017. 8. 1. 23:04

안녕하세요.


특정 IE에서 template.xml 파일 로딩 오류가 발생하는 문제를 패치하기 위한 코드입니다.
수정 파일: cheditor.js
수정 함수: loadTemplate, getCDATASection
위 두 개의 수정 함수를 아래 것으로 교체해 주십시오.

    loadTemplate : function (xmlDoc) {
        var cdata, container, dragHandle, html, modalFrame, popupWindow, tmpDiv, tmpl, toolbar;
        tmpl = xmlDoc.getElementsByTagName('Template').item(0);
        if (!tmpl) {
            throw 'Template 노드를 설정할 수 없습니다.';
        }
        cdata = tmpl.getElementsByTagName('Container').item(0).getElementsByTagName('Html').item(0);
        if (!cdata) {
            throw 'XML CDATA 오류';
        }
        html = this.getCDATASection(cdata);
        tmpDiv = document.createElement('div');
        tmpDiv.innerHTML = html;
        container = tmpDiv.firstChild;

        toolbar = tmpl.getElementsByTagName('Toolbar').item(0);
        this.createEditorElement(container, toolbar);

        cdata = tmpl.getElementsByTagName('PopupWindow').item(0).getElementsByTagName('Html').item(0);
        if (!cdata) {
            throw 'XML CDATA 오류';
        }
        html = this.getCDATASection(cdata);
        tmpDiv.innerHTML = html;
        popupWindow = tmpDiv.firstChild;
        this.cheditor.popupElem = popupWindow;

        dragHandle = popupWindow.firstChild;
        this.cheditor.dragHandle = dragHandle;
        this.cheditor.popupTitle = dragHandle.getElementsByTagName('label')[0];
        this.cheditor.popupFrameWrapper = dragHandle.nextSibling;
        container.appendChild(popupWindow);

        modalFrame = document.createElement('div');
        modalFrame.className = 'cheditor-modalPopupTransparent';
        this.cheditor.modalBackground = modalFrame;
        this.cheditor.modalBackground.id = 'popupModalBackground';
        this.cheditor.modalBackground.className = 'cheditor-popupModalBackground';
        container.parentNode.insertBefore(modalFrame, container);

        this.cheditor.htmlEditable = document.createElement('iframe');
        this.cheditor.htmlEditable.style.display = 'none';
        this.cheditor.htmlEditable.style.width = '1px';
        this.cheditor.htmlEditable.style.height = '1px';
        this.cheditor.htmlEditable.style.visibility = 'hidden';
        container.appendChild(this.cheditor.htmlEditable);
    },
    
    getCDATASection : function (node) {
        var text = node.textContent || node.text;
        text = text.replace(/\n/g, '');
        text = text.replace(/(\s+?)<([^>]*)>/g, '<$2>');
        text = this.trimSpace(text);
        return text;
    }, 

감사합니다.


Share Link
reply
«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30