Merge remote-tracking branch 'upstream/4.5' into 4.5-master-2015-03-09-21-44-34
[civicrm-core.git] / templates / CRM / Contact / Page / View / Summary.js
index 7fa6837a4ac9c1cdc7343dad559ce5ddccf99278..f38bf305b5a49f3c76da70fdb7c1f7d76f6e1824 100644 (file)
@@ -1,11 +1,25 @@
 // http://civicrm.org/licensing
 (function($, _) {
+  // FIXME: Much of this code is redundant with CRM.loadForm
 
   var ajaxFormParams = {
     dataType:'json',
     beforeSubmit: function(arr, $form, options) {
       $form.block();
     },
+    beforeSerialize: function(form, options) {
+      // Copied from crm.ajax.js
+      if (window.CKEDITOR && window.CKEDITOR.instances) {
+        $.each(CKEDITOR.instances, function() {
+          this.updateElement && this.updateElement();
+        });
+      }
+      if (window.tinyMCE && tinyMCE.editors) {
+        $.each(tinyMCE.editors, function() {
+          this.save();
+        });
+      }
+    },
     success: requestHandler,
     error: errorHandler
   };