Hi,
I try to add onBlur event using jQuery to CKEditor. When document.ready(), I replace CKEditor. After that I search for iFrame inside CKEditor and add onBlur callback to it. Problem is the frame cannot be found, but if I call the iFrame searching function after page already loaded (using FireBugs on FireFox), the frame is found. So, I think the problem is editor is not successfully created when I try to search for its frame. Does it has a callback function when the editor is created? so I can add my onBlur() listener.
Code :
$(document).ready(function(){
// add editor
editor = CKEDITOR.replace('content', {
height: ($(document).height() - 150) + 'px',
});
var ckframe = $(editor.document.getWindow().$.frameElement.contentDocument);
ckframe.blur(function () {
saveValue();
});
});
I try to add onBlur event using jQuery to CKEditor. When document.ready(), I replace CKEditor. After that I search for iFrame inside CKEditor and add onBlur callback to it. Problem is the frame cannot be found, but if I call the iFrame searching function after page already loaded (using FireBugs on FireFox), the frame is found. So, I think the problem is editor is not successfully created when I try to search for its frame. Does it has a callback function when the editor is created? so I can add my onBlur() listener.
Code :
$(document).ready(function(){
// add editor
editor = CKEDITOR.replace('content', {
height: ($(document).height() - 150) + 'px',
});
var ckframe = $(editor.document.getWindow().$.frameElement.contentDocument);
ckframe.blur(function () {
saveValue();
});
});
Re: Does CKEditor has callback function when editor is created?
This event fires once the editor is fully loaded, so is probably where you would like to tie into.
Re: Does CKEditor has callback function when editor is created?
It works now on FireFox. But on IE it still silenced, with no JavaScript error. I'm finding the problem but if anyone has any suggestion on this problem, I'd love to hear.
Re: Does CKEditor has callback function when editor is created?
Re: Does CKEditor has callback function when editor is created?
your new code discarded the error message on FireFox's FireBug console, But IE still silenced. I'm trying IE development toolbar to find the source of the problem.
Re: Does CKEditor has callback function when editor is created?
Thanks for your helpful answer, yavin.
Better method available for callback?
Is there any better method available for callback. not like the example mentioned below
$(".textarea").ckeditor(function() {
// Instance loaded callback.
}, {
// Config here.
});