With CKEditor I want to create a dialog not as part of a plugin. But, when I call openDialog for a dialog I added... it fades the screen, but I never see the dialog. Can anyone help me out?
<table cellpadding="0" cellspacing="0">
<tr>
<td style="padding:0" valign="top">
<div class="leftsidemenu sidemenu">
<div class="menusection">
<div class="menuheader">Test Menu</div>
<div class="menuitem"><a id="testClick" href="#">Test Click</a></div>
</div>
</div>
</td>
<td style="padding:0" valign="top"><div class="editor1"><textarea id='editor1'>Testing it out</textarea></div>
</td>
</tr>
</table>
Here is the javascript that adds the dialog and then opens the dialog.
<script>
$(document).ready(function () {
CKEDITOR.replace('editor1', {
height: 1000
});
CKEDITOR.on('instanceCreated', function (ev) {
var editor = ev.editor;
CKEDITOR.dialog.add('placeholderDialog', function (editor) {
return {
title: 'Link Properties',
minWidth: 400, minHeight: 200,
contents:
[
{
id: 'general', label: 'Settings',
elements:
[
{
type: 'html', html: 'This dialog window lets you create simple links for your website.'
}
]
}
]
};
});
});
$("#testClick").click(function () {
CKEDITOR.instances.editor1.openDialog('placeholderDialog');
});
});
</script>
--- Answer ---
It seems like you aren't able to reply to your own posts... but here is the answer:
CKEDITOR.replace('editor1', {
height: 1000
});
Needs to be *after*
CKEDITOR.on('instanceCreated', fun...
Because otherwise the instance is already created and the instanceCreated event has already happened.