Ticket #3988: 3988.patch

File 3988.patch, 2.9 KB (added by Garry Yao, 15 years ago)
  • _source/core/editor.js

     
    283283                        var form = element.$.form && new CKEDITOR.dom.element( element.$.form );
    284284                        if ( form )
    285285                        {
    286                                 form.on( 'submit', function()
    287                                         {
    288                                                 editor.updateElement();
    289                                         });
     286                                function onSubmit()
     287                                {
     288                                        editor.updateElement();
     289                                }
     290                                form.on( 'submit',onSubmit );
    290291
    291292                                // Setup the submit function because it doesn't fire the
    292293                                // "submit" event.
    293294                                if ( !form.$.submit.nodeName )
    294295                                {
    295                                         form.$.submit = CKEDITOR.tools.override( form.$.submit, function( originalSubmit )
    296                                                 {
    297                                                         return function()
    298                                                                 {
    299                                                                         editor.updateElement();
     296                                        function submitHandler( originalSubmit )
     297                                        {
     298                                                return function()
     299                                                        {
     300                                                                editor.updateElement();
    300301
    301                                                                         // For IE, the DOM submit function is not a
    302                                                                         // function, so we need thid check.
    303                                                                         if ( originalSubmit.apply )
    304                                                                                 originalSubmit.apply( this, arguments );
    305                                                                         else
    306                                                                                 originalSubmit();
    307                                                                 };
    308                                                 });
    309                                 }
    310                         }
    311                 }
     302                                                                // For IE, the DOM submit function is not a
     303                                                                // function, so we need thid check.
     304                                                                if ( originalSubmit.apply )
     305                                                                        originalSubmit.apply( this, arguments );
     306                                                                else
     307                                                                        originalSubmit();
     308                                                        };
     309                                        }
     310
     311                                        var originalSubmit = form.$.submit;
     312                                        form.$.submit = CKEDITOR.tools.override( form.$.submit, submitHandler );
     313                                }
     314
     315                                // Remove all 'submit' events registered on form element before destroying.(#3988)
     316                                editor.on( 'beforeDestroy', function()
     317                                {
     318                                        form.removeListener( 'submit', onSubmit );
     319                                        if ( originalSubmit )
     320                                                form.$.submit = originalSubmit;
     321                                } );
     322                        }
     323                }
    312324        };
    313325
    314326        function updateCommandsMode()
     
    447459                 */
    448460                destroy : function( noUpdate )
    449461                {
     462                        this.fire( 'beforeDestroy' );
    450463                        if ( !noUpdate )
    451464                                this.updateElement();
    452 
    453465                        this.theme.destroy( this );
    454466                        CKEDITOR.remove( this );
    455467                },
  • CHANGES.html

     
    153153                <li><a href="http://dev.fckeditor.net/ticket/3793">#3793</a> : Combined images into sprites.</li>
    154154                <li><a href="http://dev.fckeditor.net/ticket/3783">#3783</a> : Fixed indenting command in table cells create collapsed paragraph.</li>
    155155                <li><a href="http://dev.fckeditor.net/ticket/3968">#3968</a> : About dialog layout was broken with IE+Standards+RTL.</li>               
     156                <li><a href="http://dev.fckeditor.net/ticket/3988">#3988</a> : Destroy editor on form submit event cause error.</li>           
    156157        </ul>
    157158        <h3>
    158159                CKEditor 3.0 RC</h3>
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy