2010-12-03 4 views
2

안녕 난 유튜브 비디오를 삽입하려면 다음 ckeditor 플러그인 만들었습니다CKEditor 플러그인 - OK 버튼 권한 오류

(function() { 
    CKEDITOR.plugins.add('youtube', { 
     requires : ['iframedialog'], 
     init : function(editor) { 
      var iframeWindow = null; 
      CKEDITOR.dialog.add('youtube_dialog', function() { 
       return { 
        title : 'YouTube Movie Properties', 
        minWidth : 550, 
        minHeight : 200, 
        contents : [{ 
         id : 'iframe', 
         label : 'Insert YouTube Movie', 
         expand : true, 
         elements : [{ 
          type : 'iframe', 
          src : me.path + 'dialogs/youtube.html', 
          width : '100%', 
          height : '100%', 
          onContentLoad : function() { 
           iframeWindow = document.getElementById(this._.frameId).contentWindow; 
          } 
         }] 
        }], 
        onOk : function() { 
         this._.editor.insertHtml('<cke:youtube url="' + iframeWindow.document.getElementById('url').value + '">YouTube Video Place Marker</cke:youtube>'); 
        } 
       }; 
      }); 
      editor.addCommand('youtube', new CKEDITOR.dialogCommand('youtube_dialog')); 
      editor.ui.addButton('YouTube', { 
       label : 'Insert YouTube Movie', 
       command : 'youtube', 
       icon : this.path + 'images/icon.gif' 
      }); 
     } 
    }); 
})(); 

이것은 잘 작동했지만, 난 최근에 CDN 내 ckeditor 파일을 이동합니다. 이제 "확인"버튼을 클릭하면 권한 오류가 발생합니다. 나는 그들이 작동하는 방법에 대한 아이디어를 얻기 위해 기존 플러그인의 소스를보고 있었지만 시도한 것은 작동하지 않는 것으로 보인다. 뭔가 기본 작업을 얻으려면 내 okOk 이벤트를 변경하려고 시도 :

onOk : function() { 
    var hr = new CKEDITOR.dom.element('hr', editor.document); 
    editor.insertElement(hr); 
} 

그러나 이것은 null 참조 예외를 줬어.

누군가 내가 잘못하고있는 것을 나에게 보여줄 수 있다면 정말 고맙겠습니다. 감사합니다

답변

1

문제가 해결되었습니다!

CKEDITOR.dialog.add('youtube_dialog', function() 

에 :

CKEDITOR.dialog.add('youtube_dialog', function(editor) 

과 변화 :이 솔루션은 변경하는 것입니다

this._.editor 

에 :

editor 

희망이 도움이됩니다.