I am trying to use embedded CKEditor through Eclilpse Nebula in a SWT control. It uses CKEditor through in-build browser engine in Eclipse RCP. The control tries to initialize CKEditor in a Simple HTML textarea in a HTML page by using startupFocus of CKEdior, which fails to invoke. It doesn't work consistently,works in one machine but not in other. Following is the code snippet from the Nebula class, please point me in right direction why it's not working always. Thanks in advance.
CKEDITOR.replace( 'editor',
{
startupFocus : true,
on: {
'instanceReady' : function(event) {
//maximize the editor after the editor instance is ready
maximizeEditorHeight();
event.editor.on('resize', function(resizeEvent) {
if ((prevHeight == null) || prevHeight != resizeEvent.editor.container.$.clientHeight) {
prevHeight = CKEDITOR.instances.editor.container.$.clientHeight;
if (!mouseDown) {
// if the resize is trigger by an external event,
// e.g. toolbar expand/collapse
maximizeEditorHeight();
}
if (resizeCallbackEnabled) {
resizeParentContainer();
}
}
else if (prevHeight == CKEDITOR.instances.editor.container.$.clientHeight) {
prevHeight = null;
}
});
},
//notify the FocusListener
'focus' : function() { focusIn(); },
'blur' : function() { focusOut(); },
//notify the ModifyListener
'change' : function() { textModified(); },
//ensure the key pressed event is fired if Enter is pressed
'key' : function(event) { event.data.preventDefault(false); },
//notify the KeyListener
'contentDom' : function() {
this.document.on('keydown', function(evt) {
if (evt.data.$.ctrlKey && evt.data.getKey() == 70) {
//prevent opening of browser find dialog on CTRL + F
evt.data.preventDefault(false);
//open the ckeditor find and replace dialog
CKEDITOR.instances.editor.execCommand('find')
}
else if (evt.data.$.ctrlKey && evt.data.getKey() == 72) {
evt.data.preventDefault(false);
//open the ckeditor find and replace dialog
CKEDITOR.instances.editor.execCommand('replace')
}
keyPressed(evt.data.getKey(), evt.data.getKeystroke());
});
this.document.on('keyup', function(evt) {
keyReleased(evt.data.getKey(), evt.data.getKeystroke());
});
}
}
});