【问题标题】:CKEditor Plugin - OK Button Permission ErrorCKEditor 插件 - 确定按钮权限错误
【发布时间】:2010-12-10 20:26:12
【问题描述】:

您好,我创建了以下 ckeditor 插件来插入 youtube 视频:

(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);
}

但这给了我一个空引用异常。

如果有人能告诉我我做错了什么,我将不胜感激。谢谢

【问题讨论】:

    标签: javascript ckeditor


    【解决方案1】:

    问题已解决!解决方法是改变:

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

    到:

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

    并改变:

    this._.editor
    

    到:

    editor
    

    希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 2010-11-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-08
      • 2016-04-27
      • 2014-12-01
      相关资源
      最近更新 更多