I have been using 2.x versions of the FCK Editor for a customer site for several months. We just started using the ajaxAutoSave plugin. The plugin works great, except for one problem. As soon as an autosave occurs in Safari or Chrome (both Webkit browsers), the focus is lost from the editor. If a user is typing and then an autosave occurs after 10 seconds, he focus is lost and the user has to click back into the editor to continue typing. This is not a problem in IE or Firefox.
Using Firebug and brute force commenting out lines in the autosave JavaScript code, I found the offending function call to be the FCK GetXHTML(). Just assigning the result of that function to a variable causes the focus to be lost.
In trying to track this down further, we added an alert box that is displayed after an autosave occurs. The box is displayed just fine. However, I have to click OK _twice_ to make it go away. It get's even worse. If I click somewhere other than the OK button in the alert box and it is over the FCK editor toolbar, it actually clicks through to the toolbar button in that spot beneath the alert box. For instance, if I click in the alert box and the Find button is beneath the place I click, the Find box actually opens. If I click OK twice, focus is returned to the editor, however the cursor is placed before the first character within the editor, not where I was last typing before the autosave.
Also, if an autosave occurs and the focus is lost, if I CTRL-TAB to change tabs and then change back to the tab containing the editor, focus is returned. However, just as with the alert box, the cursor is placed before the first character within the editor.
All of this leads me to believe there is a problem with Webkit and not specifically with FCK. However, this is a problem I need to fix. Do you have any suggestions for a workaround? I have tried forcing focus back to the editor by calling FCK Focus(), but nothing happens. Is there something in GetXHTML() that is causing this that I can modify? Is there a different way I can access the content in the editor that will not affect the focus?
Any help is greatly appreciated.
-Pat
Using Firebug and brute force commenting out lines in the autosave JavaScript code, I found the offending function call to be the FCK GetXHTML(). Just assigning the result of that function to a variable causes the focus to be lost.
In trying to track this down further, we added an alert box that is displayed after an autosave occurs. The box is displayed just fine. However, I have to click OK _twice_ to make it go away. It get's even worse. If I click somewhere other than the OK button in the alert box and it is over the FCK editor toolbar, it actually clicks through to the toolbar button in that spot beneath the alert box. For instance, if I click in the alert box and the Find button is beneath the place I click, the Find box actually opens. If I click OK twice, focus is returned to the editor, however the cursor is placed before the first character within the editor, not where I was last typing before the autosave.
Also, if an autosave occurs and the focus is lost, if I CTRL-TAB to change tabs and then change back to the tab containing the editor, focus is returned. However, just as with the alert box, the cursor is placed before the first character within the editor.
All of this leads me to believe there is a problem with Webkit and not specifically with FCK. However, this is a problem I need to fix. Do you have any suggestions for a workaround? I have tried forcing focus back to the editor by calling FCK Focus(), but nothing happens. Is there something in GetXHTML() that is causing this that I can modify? Is there a different way I can access the content in the editor that will not affect the focus?
Any help is greatly appreciated.
-Pat