Ticket #234: 234.patch

File 234.patch, 2.0 KB (added by fredck, 20 months ago)
  • _whatsnew.html

     
    8282                        in the Paste dialog.</li> 
    8383                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1907">#1907</a>] Fixed sporadic 
    8484                        "FCKeditorAPI is not defined" errors in Firefox 3.</li> 
     85                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/234">#234</a>] Fixed 
     86                        the incompatibility with the Microsoft ASP.Net AJAX UpdatePanel.</li> 
    8587        </ul> 
    8688        <p> 
    8789                <a href="_whatsnew_history.html">See previous versions history</a></p> 
  • editor/_source/fckeditorapi.js

     
    147147 
    148148        if ( oForm ) 
    149149        { 
     150                // Fix for the ASP.Net AJAX UpdatePanel. (#234) 
     151                var win = FCKTools.GetElementWindow( oForm ) ; 
     152                if ( win && win.Sys && win.Sys.WebForms && win.Sys.WebForms.PageRequestManager ) 
     153                { 
     154                        var _onSubmitStatements; 
     155                        try 
     156                        { 
     157                                _onSubmitStatements = win.Sys.WebForms.PageRequestManager.getInstance()._onSubmitStatements ; 
     158                        } 
     159                        catch (e) {} 
     160 
     161                        if ( _onSubmitStatements ) 
     162                        { 
     163                                var updateFn = function() 
     164                                { 
     165                                        FCK.UpdateLinkedField(); 
     166                                        return true; 
     167                                } ; 
     168                                // Mark the function with the editor name. 
     169                                updateFn._fckname = FCK.Name; 
     170 
     171                                // The _onSubmitStatements may still have a referene for the 
     172                                // previous function used to update the field. So, let's scan and 
     173                                // remove it. 
     174                                for ( var i = 0 ; i < _onSubmitStatements.length ; i++ ) 
     175                                { 
     176                                        var _fckname = _onSubmitStatements[i]._fckname; 
     177                                        if ( _fckname && _fckname == FCK.Name ) 
     178                                                _onSubmitStatements.splice( i, 1 ); 
     179                                } 
     180 
     181                                _onSubmitStatements.push( updateFn ); 
     182 
     183                                return; 
     184                        } 
     185                } 
     186 
    150187                // Attach to the onsubmit event. 
    151188                FCKTools.AddEventListener( oForm, 'submit', FCK.UpdateLinkedField ) ; 
    152189