Changeset 445


Ignore:
Timestamp:
07/14/2007 12:42:16 AM (7 years ago)
Author:
alfonsoml
Message:

Fix for #321, it now tries to automatically set the editing area editable guessing when the document is visible.
There should be no need any longer to manually call MakeEditable.

Location:
FCKeditor/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • FCKeditor/trunk/_whatsnew.html

    r442 r445  
    114114                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/515">#515</a>] Tables in Firefox didn't inherint font 
    115115                        styles properly in Standards mode.</li> 
     116                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/321">#321</a>] If FCKeditor is initially hidden in Firefox 
     117                        it will no longer be neccesary to call the oEditor.MakeEditable() function.</li> 
    116118        </ul> 
    117119        <h3> 
  • FCKeditor/trunk/editor/_source/classes/fckeditingarea.js

    r442 r445  
    216216                        oDoc.execCommand( 'enableInlineTableEditing', false, !FCKConfig.DisableFFTableHandles ) ; 
    217217                } 
    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) 
     230function 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. 
     248FCKEditingArea.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() ; 
    220257} 
    221258 
Note: See TracChangeset for help on using the changeset viewer.
© 2003 – 2012 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy