【问题标题】:CKeditor 3.x plugins - Create a custom button that will open a new linkCKeditor 3.x 插件 - 创建一个自定义按钮来打开一个新链接
【发布时间】:2012-04-19 13:38:12
【问题描述】:

我正在尝试在 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 )}

【问题讨论】:

    标签: javascript plugins ckeditor html-editor


    【解决方案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');
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-11
      • 1970-01-01
      • 1970-01-01
      • 2012-11-26
      • 2021-08-05
      • 1970-01-01
      相关资源
      最近更新 更多