Ticket #234: FCKeditor-ticket234.patch

File FCKeditor-ticket234.patch, 2.4 KB (added by Pete Hurst, 16 years ago)

Patch against FCKeditor trunk r2174 adding PreventSubmitHandler

  • editor/_source/fckeditorapi.js

     
    1 /*
     1/*
    22 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
    33 * Copyright (C) 2003-2008 Frederico Caldeira Knabben
    44 *
     
    142142// Attach to the form onsubmit event and to the form.submit().
    143143function _AttachFormSubmitToAPI()
    144144{
    145         // Get the linked field form.
    146         var oForm = FCK.GetParentForm() ;
     145    // Don't attach if the config option is set
     146    if (!FCK.Config.PreventSubmitHandler) {
     147            // Get the linked field form.
     148            var oForm = FCK.GetParentForm() ;
    147149
    148         if ( oForm )
    149         {
    150                 // Attach to the onsubmit event.
    151                 FCKTools.AddEventListener( oForm, 'submit', FCK.UpdateLinkedField ) ;
     150            if ( oForm )
     151            {
     152                    // Attach to the onsubmit event.
     153                    FCKTools.AddEventListener( oForm, 'submit', FCK.UpdateLinkedField ) ;
    152154
    153                 // IE sees oForm.submit function as an 'object'.
    154                 if ( !oForm._FCKOriginalSubmit && ( typeof( oForm.submit ) == 'function' || ( !oForm.submit.tagName && !oForm.submit.length ) ) )
    155                 {
    156                         // Save the original submit.
    157                         oForm._FCKOriginalSubmit = oForm.submit ;
     155                    // IE sees oForm.submit function as an 'object'.
     156                    if ( !oForm._FCKOriginalSubmit && ( typeof( oForm.submit ) == 'function' || ( !oForm.submit.tagName && !oForm.submit.length ) ) )
     157                    {
     158                            // Save the original submit.
     159                            oForm._FCKOriginalSubmit = oForm.submit ;
    158160
    159                         // Create our replacement for the submit.
    160                         oForm.submit = FCKeditorAPI._FormSubmit ;
    161                 }
     161                            // Create our replacement for the submit.
     162                            oForm.submit = FCKeditorAPI._FormSubmit ;
     163                    }
     164            }
    162165        }
    163166}
    164167
  • fckconfig.js

     
    4242FCKConfig.Debug = false ;
    4343FCKConfig.AllowQueryStringDebug = true ;
    4444
     45// Used for server-side implementations which wire up their own events.
     46// In these situations we don't want to mess up any existing submit behaviour.
     47FCKConfig.PreventSubmitHandler = false;
     48
    4549FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/default/' ;
    4650FCKConfig.SkinEditorCSS = '' ;  // FCKConfig.SkinPath + "|<minified css>" ;
    4751FCKConfig.SkinDialogCSS = '' ;  // FCKConfig.SkinPath + "|<minified css>" ;
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy