Changeset 623

Show
Ignore:
Timestamp:
2007-08-03 12:56:52 (3 years ago)
Author:
fredck
Message:

Small change to [608] (fix for #141), to avoid making changes in the selection. Also, moved it to a dedicated function to avoid code duplications.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor/trunk/editor/_source/classes/fckeditingarea.js

    r621 r623  
    175175                oDoc.body.removeAttribute( "disabled" ) ; 
    176176 
    177                 var delayedExec = function() 
    178                 { 
    179                         var range = oDoc.selection.createRange() ; 
    180                         range.moveEnd( "character", 1 ) ; 
    181                         range.select() ; 
    182                         range.collapse( true ) ; 
    183                         range.select() ; 
    184                 } 
    185                 setTimeout( delayedExec, 1 ) ; 
    186  
    187177                /* The following commands don't throw errors, but have no effect. 
    188178                oDoc.execCommand( 'AutoDetect', false, false ) ; 
     
    274264                        // http://sourceforge.net/tracker/index.php?func=detail&aid=1567060&group_id=75348&atid=543653 
    275265                        if ( FCKBrowserInfo.IsIE && this.Document.hasFocus() ) 
    276                                 // In IE it can happen that the document is in theory focused but the active element is outside it 
    277                                 this.Document.body.setActive() ; 
     266                                this._EnsureFocusIE() ; 
    278267 
    279268                        if ( FCKBrowserInfo.IsSafari ) 
     
    285274                                // In IE it can happen that the document is in theory focused but the active element is outside it 
    286275                                if ( FCKBrowserInfo.IsIE ) 
    287                                         this.Document.body.setActive() ; 
     276                                        this._EnsureFocusIE() ; 
    288277                        } 
    289278                } 
     
    298287        } 
    299288        catch(e) {} 
     289} 
     290 
     291FCKEditingArea.prototype._EnsureFocusIE = function() 
     292{ 
     293        // In IE it can happen that the document is in theory focused but the active element is outside it 
     294        this.Document.body.setActive() ; 
     295 
     296        // Kludge for #141... yet more code to workaround IE bugs 
     297        var range = this.Document.selection.createRange() ; 
     298        range.moveEnd( "character", 1 ) ; 
     299        range.select() ; 
     300        range.moveEnd( "character", -1 ) ; 
     301        range.select() ; 
    300302} 
    301303