Hello all,
I have integrated CKeditor in my own CMS (PHP based) and I have now added a plug-in that browses a list of images. The idea was to be able to insert images back in the editor but each time I use the insertHTML instruction, my script stops.
Here is my setup for more information.
Inside plugin.js
CKEDITOR.plugins.add('imagebrowser', {
"init": function(editor) {
var pluginName = 'imagebrowser';
editor.ui.addButton('imagebrowser', {
label: 'Image browser',
command: pluginName,
click: function(editor) {
var postData = 'form_type=list&page_type=photo&procedure=load_form&object_id=&referrer=ckeditor';
$.ajax({
type: 'POST',
url: 'php/sl.php',
data: postData,
cache: false,
async: false,
dataType: 'html',
success: function(result) {
ManageLayer('list_content');
$('#list_content').html(result);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert(XMLHttpRequest.status);
alert(XMLHttpRequest.responseText);
$('#indicator').css("display", "none");
},
});
}
});
}
});
This scripts call a php file with some parameters to display my list of image. Up to here, everything works as expected.
The CKeditor itself is inserted in the following textarea: (also working fine)
<textarea id="page_article"></textarea>
in my Image browser page, I have buttons attached to each picture, clicking on the button triggers the following code:
var editor = CKEDITOR.instances['page_article'];
editor.insertHtml('some html');
The html is never inserted in the editor and if I look at my javascript console, I get the following error message:
TypeError: w is undefined
ckeditor.js line 359 col 52
I have checked if the editor instance is working:
if (editor) { alert('ok'); }
I get "ok" but the code stops at the insertHtml line.
I'm completely stuck and I don't see what is the problem.
Any idea?
Thanks
Laurent