| 218 | | catch (e) {} |
| 219 | | } |
| | 218 | catch (e) |
| | 219 | { |
| | 220 | // In Firefox if the iframe is initially hidden it can't be set to designMode and it raises an exception |
| | 221 | // So we set up a DOM Mutation event Listener on the HTML, as it will raise several events when the document is visible again |
| | 222 | FCKTools.AddEventListener( this.Document, 'DOMAttrModified', FCKEditingArea_Document_AttributeNodeModified ) ; |
| | 223 | } |
| | 224 | |
| | 225 | } |
| | 226 | } |
| | 227 | |
| | 228 | // This function processes the notifications of the DOM Mutation event on the document |
| | 229 | // We use it to know that the document will be ready to be editable again (or we hope so) |
| | 230 | function FCKEditingArea_Document_AttributeNodeModified( evt ) |
| | 231 | { |
| | 232 | var oDoc = evt.currentTarget ; |
| | 233 | var oWindow = oDoc.defaultView ; |
| | 234 | var editingArea = oWindow._FCKEditingArea ; |
| | 235 | |
| | 236 | // We want to run our function after the events no longer fire, so we can know that it's a stable situation |
| | 237 | if ( editingArea._timer ) |
| | 238 | { |
| | 239 | oWindow.clearTimeout( editingArea._timer ) ; |
| | 240 | delete editingArea._timer ; |
| | 241 | } |
| | 242 | |
| | 243 | editingArea._timer = FCKTools.SetTimeout( editingArea._MakeEditableByMutation, 1000, editingArea ) ; |
| | 244 | } |
| | 245 | |
| | 246 | // This function ideally should be called after the document is visible, it does clean up of the |
| | 247 | // mutation tracking and tries again to make the area editable. |
| | 248 | FCKEditingArea.prototype._MakeEditableByMutation = function() |
| | 249 | { |
| | 250 | // Clean up |
| | 251 | delete this._timer ; |
| | 252 | // Now we don't want to keep on getting this event |
| | 253 | FCKTools.RemoveEventListener( this.Document, 'DOMAttrModified', FCKEditingArea_Document_AttributeNodeModified ) ; |
| | 254 | // Let's try now to set the editing area editable |
| | 255 | // If it fails it will set up the Mutation Listener again automatically |
| | 256 | this.MakeEditable() ; |