I'm using CKEditor a long time. But I'm facing some problem when trying
to load a large document using setData()
method.The problem is the data is not
setting to the editor(editor is Empty). What I'm done is,
Initialize Editor on when the page is loaded.
<textarea id='editor1'></textarea>
<script>
var editor = CKEDITOR.replace('editor1');
</script>
At the same time I'm calling some function which will set the data like below.
setData(data);
function setData(data){
CKEDITOR.instances['editor1'].setData(data);
}
This will work on sometime but sometimes nothing is visible in the editor.
What am I doing wrong? Please, help me with this...
Note:
And there is no console error will be shown if the data is not setted to the document.
try CKEDITOR.replace(
with instanceReady
CKEDITOR.replace('editor1', {
on: {
instanceReady: function( evt ) {
// your stuff here
}
}
});
or
try CKEDITOR.inline(
with instanceReady
CKEDITOR.inline('editor1', {
on: {
instanceReady: function () {
}
})