I added two iframedialog plugins ( myplugin, helloworld) under /ckeditor/plugins folder. If I added one plugin in the toolbar, it works great. But when I add two plugins in the same editor, the editor display two different buttons, but shows the same popup page ( randomly choose one page ).
Helloworld plugin.js
CKEDITOR.plugins.add('helloworld',
{
requires: ['iframedialog'],
init: function (editor) {
var pluginName = 'helloworld';
var mypath = this.path;
editor.ui.addButton(
'helloworld',
{
label: "hello world Plug-in",
command: 'helloworld.cmd',
icon: mypath + '\images\block_address.png'
}
);
var cmd = editor.addCommand('helloworld.cmd', { exec: showDialogPlugin });
CKEDITOR.dialog.addIframe(
'helloworld.dlg',
'Hello Title',
mypath + 'helloworld.aspx',
550,
400,
function () {
}
);
}
}
);
function showDialogPlugin(e) {
e.openDialog('helloworld.dlg');
}
Myplugin plugin.js
CKEDITOR.plugins.add('myplugin',
{
requires: ['iframedialog'],
init: function (editor) {
var pluginName = 'myplugin';
var mypath = this.path;
editor.ui.addButton(
'myplugin',
{
label: "my plug in",
command: 'myplugin.cmd',
icon: mypath + 'audiorecorder.png'
}
);
var cmd = editor.addCommand('myplugin.cmd', { exec: showDialogPlugin });
CKEDITOR.dialog.addIframe(
'myplugin.dlg',
'My Title',
mypath + 'my.htm',
550,
400,
function () {
}
);
}
}
);
function showDialogPlugin(e) {
e.openDialog('myplugin.dlg');
}
Thank you in advance,
Lan
Helloworld plugin.js
CKEDITOR.plugins.add('helloworld',
{
requires: ['iframedialog'],
init: function (editor) {
var pluginName = 'helloworld';
var mypath = this.path;
editor.ui.addButton(
'helloworld',
{
label: "hello world Plug-in",
command: 'helloworld.cmd',
icon: mypath + '\images\block_address.png'
}
);
var cmd = editor.addCommand('helloworld.cmd', { exec: showDialogPlugin });
CKEDITOR.dialog.addIframe(
'helloworld.dlg',
'Hello Title',
mypath + 'helloworld.aspx',
550,
400,
function () {
}
);
}
}
);
function showDialogPlugin(e) {
e.openDialog('helloworld.dlg');
}
Myplugin plugin.js
CKEDITOR.plugins.add('myplugin',
{
requires: ['iframedialog'],
init: function (editor) {
var pluginName = 'myplugin';
var mypath = this.path;
editor.ui.addButton(
'myplugin',
{
label: "my plug in",
command: 'myplugin.cmd',
icon: mypath + 'audiorecorder.png'
}
);
var cmd = editor.addCommand('myplugin.cmd', { exec: showDialogPlugin });
CKEDITOR.dialog.addIframe(
'myplugin.dlg',
'My Title',
mypath + 'my.htm',
550,
400,
function () {
}
);
}
}
);
function showDialogPlugin(e) {
e.openDialog('myplugin.dlg');
}
Thank you in advance,
Lan
Re: multiple iframedialog plugins display the same dialog
should use this way:
(function () {
CKEDITOR.plugins.add('myplugin',
{
requires: ['iframedialog'],
init: function (editor) {
var me = this;
CKEDITOR.dialog.add('mypluginDialog', function () {
return {
title: 'my plugin Dialog',
minWidth: 550,
minHeight: 200,
contents:
[
{
id: 'iframe',
label: 'Insert your plugin ...',
expand: true,
elements:
[
{
type: 'iframe',
src: me.path + 'myplugin.aspx',
width: '100%',
height: '100%',
onContentLoad: function () {
// Iframe is loaded...
}
}
]
}
],
onOk: function () {
// Notify your iframe scripts here...
}
};
});
editor.addCommand('myplugin', new CKEDITOR.dialogCommand('mypluginDialog'));
editor.ui.addButton('myplugin',
{
label: 'Insert my plugin...',
command: 'myplugin',
icon: this.path + 'myplugin.png'
});
}
});
})();