Ticket #234: 234_3_FCKeditor_Net.patch

File 234_3_FCKeditor_Net.patch, 3.1 KB (added by Frederico Caldeira Knabben, 16 years ago)

Part 2 of 2 : Targeted to the FCKeditor.Net trunk

  • _whatsnew.html

     
    3333        <h1>
    3434                FCKeditor.Net ChangeLog - What's New?</h1>
    3535        <h3>
    36                 Version 2.6.1 (SVN)</h3>
     36                Version 2.6.3 (SVN)</h3>
    3737        <p>
    3838                New Features and Improvements:</p>
    3939        <ul>
     
    4242        <p>
    4343                Fixed Bugs:</p>
    4444        <ul>
    45                 <li></li>
     45                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/234">#234</a>] Fixed
     46                        the incompatibility with the Microsoft ASP.Net AJAX UpdatePanel.</li>
    4647        </ul>
    4748        <h3>
    4849                Version 2.6</h3>
  • FCKeditor.cs

     
    4444        [ ParseChildren(false) ]
    4545        public class FCKeditor : System.Web.UI.Control, IPostBackDataHandler
    4646        {
     47                private bool _IsCompatible ;
     48
    4749                public FCKeditor()
    4850                {}
    4951
     
    342344                {
    343345                        writer.Write( "<div>" ) ;
    344346
    345                         if ( this.CheckBrowserCompatibility() )
     347                        if ( _IsCompatible )
    346348                        {
    347349                                string sLink = this.BasePath ;
    348350                                if ( sLink.StartsWith( "~" ) )
     
    388390                        }
    389391
    390392                        writer.Write( "</div>" ) ;
     393
    391394                }
    392395
     396                protected override void OnPreRender( EventArgs e )
     397                {
     398                        base.OnPreRender( e );
     399                       
     400                        _IsCompatible = this.CheckBrowserCompatibility();
     401
     402                        if ( !_IsCompatible )
     403                                return;
     404
     405                        object oScriptManager = null;
     406
     407                        // Search for the ScriptManager control in the page.
     408                        Control oParent = this.Parent;
     409                        while ( oParent != null )
     410                        {
     411                                foreach ( object control in oParent.Controls )
     412                                {
     413                                        // Match by type name.
     414                                        if ( control.GetType().FullName == "System.Web.UI.ScriptManager" )
     415                                        {
     416                                                oScriptManager = control;
     417                                                break;
     418                                        }
     419                                }
     420
     421                                if ( oScriptManager != null )
     422                                        break;
     423
     424                                oParent = oParent.Parent;
     425                        }
     426
     427                        // If the ScriptManager control is available.
     428                        if ( oScriptManager != null )
     429                        {
     430                                try
     431                                {
     432                                        // Use reflection to check the SupportsPartialRendering
     433                                        // property value.
     434                                        bool bSupportsPartialRendering = ((bool)(oScriptManager.GetType().GetProperty( "SupportsPartialRendering" ).GetValue( oScriptManager, null )));
     435
     436                                        if ( bSupportsPartialRendering )
     437                                        {
     438                                                string sScript = "(function()\n{\n" +
     439                                                        "\tvar editor = FCKeditorAPI.GetInstance('" + this.ClientID + "');\n" +
     440                                                        "\tif (editor)\n" +
     441                                                        "\t\teditor.UpdateLinkedField();\n" +
     442                                                        "})();\n";
     443
     444                                                // Call the RegisterOnSubmitStatement method through
     445                                                // reflection.
     446                                                oScriptManager.GetType().GetMethod( "RegisterOnSubmitStatement", new Type[] { typeof( Control ), typeof( Type ), typeof( String ), typeof( String ) } ).Invoke( oScriptManager, new object[] {
     447                                                        this,
     448                                                        this.GetType(),
     449                                                        "FCKeditorAjaxOnSubmit_" + this.ClientID,
     450                                                        sScript } );
     451
     452                                                // Tell the editor that we are handling the submit.
     453                                                this.Config[ "PreventSubmitHandler" ] = "true";
     454                                        }
     455                                }
     456                                catch { }
     457                        }
     458                }
     459
    393460                #endregion
    394461
    395462                #region Compatibility Check
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy