I have integrated CKEditor 3.1 with Vaadin 6.3 and it seems to more or less work well, but I have noted an issue with the event ordering that I'm not sure if I can somehow fix or not.
I find that the 'blur' event from the editor usually fires before the onclick event on a button, but not always. Since to reach the button I have to blur first, I was hoping I could get the blur event first to retrieve the editor contents before the button is pressed (which I'm using to send the data to the server via ajax):
Any ideas would be much appreciated. Thanks!
I find that the 'blur' event from the editor usually fires before the onclick event on a button, but not always. Since to reach the button I have to blur first, I was hoping I could get the blur event first to retrieve the editor contents before the button is pressed (which I'm using to send the data to the server via ajax):
myEditor.on( 'blur', function( ev ) { if ( this.checkDirty() ) { ev.listenerData.@org.vaadin.openesignforms.ckeditor.widgetset.client.ui.CKEditorService.CKEditorListener::onChange()(); this.resetDirty(); // Not sure if this is a good idea or not, but trying to queue to the server only once per checkDirty() } }, null, listener);
Any ideas would be much appreciated. Thanks!
Re: CKEditor 3.1 events
In focusmanager.js, it appears that blur() has a 100ms delay built in to avoid some other (unspecified) focus/blur effects. And it says you can use forceBlur() to do an immediate blur, which is perhaps what I need. However, it's not clear how to tell CKEditor to use forceBlur() instead of blur() in the natural workings of the system (when the editor loses focus, I'd like it to call forceBlur() instead of blur()).
Does anybody know how best to accomplish this? Should I just set CKEDITOR.focusManager.prototype[blur] = forceBlur? Is there a way to override this in a "standard" way? Thanks.
COMMENT/UPDATE:
I added code like:
This appears to remove the bug I see where a button's click event coming in before the editor's blur, but want to be sure this is a reasonable approach and not overly a hack. When I do this, I don't currrently see any blur/focus effects described in the code comments, but wonder what those effects are.