CKeditor 3.x插件 - 创建一个自定义按钮,用于打开新链接

时间:2012-04-19 13:38:12

标签: javascript plugins ckeditor html-editor

我正在尝试在CKEditor工具栏上创建一个自定义按钮(插件),一旦点击将在新窗口中打开预设的URL - 任何人都可以提供一些帮助这是我迄今为止在我的内容plugin.js文件。

我基本上只想说一旦点击这个按钮就转到新窗口中的URL。有什么想法吗?

CKEDITOR.plugins.add('inserthtml',   {    
requires: ['dialog'],
lang : ['en'], 
init:function(a) { 
var b="inserthtml";
var c=a.addCommand(b,new CKEDITOR.dialogCommand(b));
    c.modes={wysiwyg:1,source:0};
    c.canUndo=false;
a.ui.addButton("inserthtml",{
                label:a.lang.inserthtml.title,
                command:b,
                icon:this.path+"inserthtml.gif"
});
CKEDITOR.dialog.addIframe(b, b, 'http://pixlr.com/express', 800, 640 )} 
});

我在Firebug中遇到的错误

CKEDITOR.dialog.addIframe is not a function 
CKEDITOR.dialog.addIframe(b, b, 'http://pixlr.com/express', 800, 640 )}

1 个答案:

答案 0 :(得分:1)

不要使用包含无意义变量名的压缩文件,请遵循以下教程:http://docs.cksource.com/CKEditor_3.x/Tutorials/Timestamp_Plugin并替换行

editor.insertHtml( 'The current date and time is: <em>' + timestamp.toString() + '</em>' );

打电话打开一个窗口:

window.open('http://pixlr.com/express');
相关问题