0
votes

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());
                				    });
                				}
                			}
                		});
1
I can not answer that question without further information. "works in one machine but not in other" is to unspecific. What doesn't work? What is the difference between the two machines/environments? Does it not work in your application or when started from the IDE? What IDE do you use? What environment (Win/Linux/Mac)? Typically it is a browser issue as startupFocus is a ckeditor feature. So you could also try to check if ckeditor in general works on "the other machine" - Dirk Fauth
Apologies for missing information, Both the machines have Win7, Eclipse 3.5, added the control in an Eclipse RCP, running from Eclipse. Both the machines have same version of IE and settings seem to be same. startupFocus is only for setting focus in the control. Even if we remove that part the CHKEDITOR.replace fails with only showing the textArea. Still not able to figure out what's going wrong. - ctangudu
Eclipse 3.5? You need at least Luna - Dirk Fauth
I wish, I could do it on that, but our target environment in production is still on that. But, it's working in a machine. - ctangudu
Then the one machine doesn't have the target environment activated. Luna is required because of issues with the SWT Browser widget in prior versions. - Dirk Fauth

1 Answers

1
votes

No because the HTML templates are referencing the js libraries and I couldn't find a way to specify those references within a jar. If you have an idea to solve that, feel free to contribute.