2
嗨,我已經創建瞭如下CKEditor的插件插入YouTube視頻: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'
});
}
});
})();
這是工作正常,但我最近搬到我的CKEditor的文件到一個CDN。現在,當我點擊「確定」按鈕時,我收到了一個權限錯誤。我正在查看現有插件的來源,以瞭解它們如何工作,但我所嘗試的任何內容似乎都無效。爲了得到一些基本的工作,我試着將我的OkOk事件改爲:
onOk : function() {
var hr = new CKEDITOR.dom.element('hr', editor.document);
editor.insertElement(hr);
}
但是這給了我一個空引用異常。
我真的很感激,如果有人能告訴我我做錯了什麼。謝謝